# TAOCP 1.2.1 Mathematical Induction

> Study guide to TAOCP 1.2.1 Mathematical Induction. Induction as the main tool for proving things about integers and about programs. Knuth goes further than…

Updated October 20, 2026.

## Summary {#summary}

TAOCP 1.2.1 Mathematical Induction: Induction as the main tool for proving things about integers and about programs. Budget about 6 hours; do exercises 1, 2 and 3.

Knuth goes further than a typical math class by showing how to prove an algorithm correct by attaching assertions to each step of a flowchart, using an extended version of Euclid's algorithm as the worked example.

## Key facts {#key-facts}

- Week 30 of 145 on the cracked.guide path, in [TAOCP Vol 1: Fundamental Algorithms](https://cracked.guide/taocp/volume-1).
- Time budget: about 6 hours.
- 15 exercises in the section, rated 05 to 50; the guide picks 8.
- Picked exercises with Knuth's triangle for recommended: 8, 13 and 15.
- Before you start: 1.1 Algorithms and basic induction proofs (week 0).

## Week 30 goals {#objectives}

By the end of week 30 you can:

- Prove simple statements about integers by mathematical induction.
- Explain how flowchart assertions prove an algorithm correct.
- Recognize the hole in a flawed induction argument.

## This week's steps {#steps}

- Read §1.2.1 Mathematical Induction: Read the basic induction material quickly if you have seen it before.
- Work the exercises (8 picked): Start with Ex 1, Ex 2, Ex 3; log what you solve below.
- Write down one thing you'd explain to someone: A few sentences in your own words in Your notes: the idea, why it works, an example. 30 words ticks this.

## Exercises {#exercises}

This section has 15 exercises, rated 05 to 50, and Knuth marks three of them with the triangle for recommended. Do the 00 to 20 ones quickly, then grind out the recommended 8 and 13. Number 14 is rated 50, Knuth's mark for an open research problem; just read it. Always read the answers, even for exercises you got, because they often teach a second technique.

Worth your time:

- 1 (rated 05): Adapt induction to start from zero. Checks you know what the base case is actually for.
- 2 (rated 15): Find the hole in a bogus induction proof. Great training for code review.
- 3 (rated 18): Another plausible proof that fails at a specific n. Subtler than the last one.
- 5 (rated 21): Prove every integer above 1 factors into primes, using strong induction.
- 6 (rated 20): Check that the extended Euclid invariants survive one step. This is the core technique of the section in miniature.
- 8 (rated 25, recommended): Prove a pattern about odd numbers summing to cubes, then use it to get the closed form for the sum of cubes.
- 13 (rated M23, recommended): Add a step counter to extended Euclid and prove a bound on it with assertions. Program proofs meet running time.
- 15 (rated HM28, recommended): Work out how induction should go for statements about two integers. The stretch, and it leads to well-ordering.

## Why it matters {#why}

Loop invariants, the thing that makes binary search and in-place algorithms correct, are induction in disguise. Once you can write the invariant, debugging off-by-one errors gets a lot less random.

## Before you start {#before}

- 1.1 Algorithms
- Basic induction proofs (week 0)

## How to approach it {#approach}

Read the basic induction material quickly if you have seen it before. Slow way down for the flowchart-with-assertions proof of the extended Euclid algorithm: copy the flowchart onto paper and check every assertion yourself, step by step. That technique is the payoff of the section.

## Common traps {#traps}

- Forgetting the base case or proving the step only for large n.
- Strengthening the hypothesis is often the trick: if the induction step will not go through, try proving something stronger.
- Reading the assertion proof without actually checking each arrow. You will not absorb it passively.

## Links {#links}

- [Knuth's TAOCP page (editions, errata, MIX/MMIX)](https://www-cs-faculty.stanford.edu/~knuth/taocp.html)
- [Vol 1 errata (plain text, from Knuth)](https://www-cs-faculty.stanford.edu/~knuth/err1.textxt)
- [Wikipedia: Mathematical induction](https://en.wikipedia.org/wiki/Mathematical_induction)
- [Wikipedia: Loop invariant](https://en.wikipedia.org/wiki/Loop_invariant)
- [Wikipedia: Floyd-Hoare logic](https://en.wikipedia.org/wiki/Floyd%E2%80%93Hoare_logic)

---

Source: https://cracked.guide/guide/knuth-w018-0
cracked.guide: A free, dated 145-week path to getting genuinely cracked at programming.
