Volume P0 · Guide
How to use the handbook: paths, hints and status lines
Draft. This chapter is written and checked by the tools of the project, and a person has not reviewed it yet. Read it with care.
Contents
The three series and their links
Section 1.6 introduced the three series: P for the background, C for the reading of each section of TAOCP, X for the solutions of the exercises. This section shows how a page of one series points to the others.
A companion section
A companion section follows one section of TAOCP. Its front matter names the section of the book in the key follows, the P chapters it needs in requires, and the parallel reading in reads_with. Its text has seven parts, always in the same order (spec 11.3):
- Overview. What the section of the book does and which earlier sections it uses.
- The ideas. The key ideas in the handbook's words, with small examples that you can do by hand.
- Definitions, results and proofs. Each item of the section with a full proof and a worked example.
- Algorithms and programs. Each algorithm in the handbook's pseudocode, a run on a small input, its proof and its cost.
- The exercises. A table of the exercises of the section with rating, markers, kind and status, and a guide to the order in which to work them.
- Lean. The Lean statements of the main results, with their status.
- Notes and history. Where the results come from, other proofs, later work and errata.
Example. The companion chapter for Section 1.2.6 has follows: "1.2.6". Its requires names P2 Ch. 6 and P2 Ch. 7, which teach binomial coefficients. Its reads_with names Chapter 5 of Concrete Mathematics. So its first lines tell you what to read before and beside it.
Example. Part 5 of the same chapter lists exercise 1.2.6-10 with its rating M25, the triangle, the kind K1 and its Lean status. The table has no text of the exercise. The number links to the solution in X1.
The links backward and forward
A companion section never proves again a result of a P volume. It cites the result by number, for example "Theorem P2.6.35". You follow the number back when you need the proof. A companion section also never solves an exercise in full. It gives the number of the exercise, and the solution is in the Solutions volume of that volume of TAOCP.
So a reader moves in three directions:
- back to a P volume for the mathematics,
- across to the book for the text,
- forward to an X volume for the solutions.
Example. A reader of the companion chapter on Section 5.1.3 meets the Eulerian numbers. The chapter cites their definition in P2 Ch. 8 and does not define them again. The reader opens P2 Ch. 8, reads the definition and its two examples, and returns.
A section of a P volume
A section of a P volume has its own parts: Statement, Proof, Examples, Exercises, Lean, and Notes and history. Each definition is followed by two examples. Each proof is complete. The exercises of a P volume are new exercises of the handbook, not exercises of TAOCP, and their solutions are at the end of the volume. The key reads_with names the chapter of the spine text that the section follows, for example a chapter of Concrete Mathematics for P2.
Example. A section of P2 on sums has reads_with: [GKP94:2.1]. This points to Section 2.1 of Concrete Mathematics. The two texts teach the same topic in different words, and you can read either first.
Example. At the end of each chapter of P2, a table lists the numbered equations of Section 1.2 of TAOCP that use the results of the chapter. A reader of Section 1.2.3 can look up eq. 1.2.3(14) and find the result of P2 that proves it.
The reading paths
A reading path is a list of chapters of the handbook in an order that works for one kind of reader. The handbook has eight paths (spec 11.5). The site shows each one at /learn/paths/ with a box to tick for each chapter.
The eight paths
| Path | For | Start with | Time |
|---|---|---|---|
| Full | a strong undergraduate | P0, P1, P2, P7, then C1 and C2 with X1 | four years, a course a semester |
| Volume 1 course | a one-semester course | P0 Ch. 1 to 3; P2 Ch. 1 to 8; P7 Ch. 1 to 7 | one semester |
| Concrete Mathematics reader | a reader who knows that book | P0; P7; then C1 to C6 | two years |
| Sorting and searching | a reader who wants Volume 3 | P0; P2 Ch. 1 to 8; P3 Ch. 1 to 5; P4; P5 Ch. 1 to 5 | two semesters |
| Combinatorial algorithms | a reader who wants Volume 4 | P0; P2; P3; P6 Ch. 8; P8 | two semesters |
| Seminumerical | a reader who wants Volume 2 | P0; P2; P4; P6 | two semesters |
| Analysis of algorithms | a graduate student | P3, P4, P5 in full | one semester |
| Lean contributor | a person who writes Lean for the project | P0 Ch. 4 and 5; P7 Ch. 9 to 12 | four weeks |
The table gives only the start of each path. The full list of each path, with the companion and Solutions chapters, is in spec 11.5 and on the site.
How to choose
Ask three questions.
- Which volume of TAOCP do you want to read? The path follows from the volume: Volume 1 leads to the paths Full or Volume 1 course, Volume 2 to Seminumerical, Volume 3 to Sorting and searching, Volume 4 to Combinatorial algorithms.
- What do you know already? A reader who knows Concrete Mathematics well can skip P2. A reader who writes proofs with ease can skip P1.
- How much time do you have? The times of the table assume about ten hours a week.
Example. A second-year student in computer science wants to read Volume 1 in one semester, with a teacher. The student has had a first course in discrete mathematics. The path is "Volume 1 course". The student reads P0 Ch. 1 to 3 in the first week, P2 Ch. 1 to 8 over six weeks, P7 Ch. 1 to 7 over four weeks, and then C1 with X1 for Section 1.2.
Example. A programmer with a degree in mathematics wants Section 7.1.3 and Section 7.2.2.2 of Volume 4. The path is "Combinatorial algorithms". The programmer reads P0, skims P2, reads P8, and then the companion volumes C7 and C8.
Paths and the order of writing
The handbook is written over several years in the order of the milestones (spec 11.10). Some chapters of a path may not exist yet when you start. The site shows which chapters of each path are drafted and which are reviewed.
Example. At milestone S1, P0 and P2 Ch. 1 to 8 are drafted, and the companion section on Section 1.2 is in work. A student on the path "Volume 1 course" can start P0 and P2 at once, and reads Section 1.3 of the book with P7 when P7 is drafted.
Example. A teacher plans a course on the mathematical preliminaries for the next year. The course plan on the site (/teach/) lists P1, P2 and the companion section on Section 1.2 with X1, with Concrete Mathematics as the parallel text. The teacher checks the status of each chapter before the term starts.
Hints before solutions
Each exercise in a Solutions volume is one file with six parts: the task, the hints, the solution, the check, the Lean part and the remarks (spec 11.4). The hints come before the solution on purpose. They let you finish the exercise yourself with as little help as you need.
The three hints
An exercise has one to three hints. They are graded:
- The first hint says where to look. It names a section, an equation or an earlier exercise.
- The second hint gives the method. It names the technique: an induction on a certain variable, a change of the index of a sum, a generating function.
- The third hint gives the key step. It shows the one step that makes the rest routine.
On the site, the hints are folded. You open them one at a time. The solution opens only after one more click. In the PDF and EPUB volumes, the hints are printed before the solution, and the solution starts on a new line with its own heading, so that you can cover it with a sheet of paper.
Example. Here is a set of hints for an imagined exercise: find a closed form of . Hint 1: Section 1.2.3 has a method for sums of this shape. Hint 2: use the perturbation method: write the sum in two ways. Hint 3: after you split off the last term and shift the index, you get . The answer is .
Example. Check the answer of the example for small . For the sum is 0, and . For the sum is , and . This is the kind of test that the Check part of every solution gives.
How to use them
Use the hints with the plan of Section 2.2.
- Work for the time of the band before the first hint.
- Read one hint. Work again for at least half that time.
- Read the next hint only when you are stuck again.
- Read the solution after the last hint, or when you have your own answer and want to compare.
A hint is not a failure. A reader who needs the first hint and then finishes alone has done the exercise. A reader who reads the solution at once has only read it.
The other parts of a solution file
- The task gives the exercise in the handbook's words, with its number and rating. It is a summary. Read the exact wording in the book.
- The solution gives every step that a student at the level of the rating needs. For a rating of 30 or more, a plan of the proof comes first. When the solution differs from Knuth's answer, it says how and why.
- The check tells you how to test the answer: small cases and their values, a run of the lab, or a special value.
- The Lean part gives the Lean statement and its status (Chapter 4).
- The remarks give generalizations, links to other exercises, the entry of the OEIS when there is one, and errata notes.
Example. The solution of an exercise rated 12 can be three lines. The solution of an exercise rated M35 can be three pages, with a plan in five steps at the top. Both are "as long as the student needs and no longer" in the sense of the style rules (spec 11.7).
Example. An exercise of kind K9 has no solution part. It has the task, the state of the problem with a date, what is known, and the Lean statement of the open problem. Its status is open.
The status lines
Every section of the handbook has a status. The status says how far the section has been checked. It is in the front matter of the section, and the site and the PDF show it. There are three values: drafted, checked and reviewed (spec 11.8).
The three values
| Status | Meaning | Who sets it |
|---|---|---|
| drafted | the text exists and passes the format check | the writer, a person or a model |
| checked | a second pass and the script checks found no problem | a second model pass and thb check |
| reviewed | a person with the right background has read it and signed it | the reviewer, in reviewed_by |
A section becomes checked when all of these hold:
- every number in a worked example or a check agrees with a computation;
- every cited item of TAOCP exists at the given number;
- every
Node:line and every key ofrequiresandreads_withresolves; - the parts are present and in order;
- a solution agrees with the Lean
answerof its node, when there is one; - the leak guard passes, and the style rules hold.
A section becomes reviewed when a person reads it and adds a name to reviewed_by. For the P volumes, the reviewers are graduate students who have taught from the spine text, and one faculty member signs each volume. For the Solutions volumes, a reviewer signs one section of TAOCP as a batch, after reading every exercise rated 30 and above and a sample of the rest.
Example. The front matter of a section of P2 at milestone S1 has the lines status: drafted, drafted_by: writer@claude-opus-5-5 and reviewed_by: []. This tells you that a model wrote the section, that the format check passed, and that nobody has reviewed it yet.
Example. A section with status: reviewed and reviewed_by: [a name] has been read by that person. The name is public. If you find an error in a reviewed section, report it (Section 3.6). The reviewer is told.
What the status means for you
Only reviewed chapters go into a numbered release of the handbook. Drafts appear in the builds marked -dev and on the site with a banner. Read a draft with care: its mathematics has been checked by computation, but no person has signed it.
The status of a section is not the status of a result. A section can be reviewed and still describe a theorem whose Lean proof does not exist yet. The Node lines and the Lean part give the status of each result (Chapter 5).
Example. A reviewed companion section says that eq. 1.2.6(21) is "stated" in Lean. The text is checked by a person. The Lean statement exists, but no Lean proof does yet. These are two different facts, and the page shows both.
Example. You read a draft section of P2 and find a worked example whose numbers you cannot reproduce. Compute it again with a short program. If your result differs, report it. A draft is exactly the stage at which such a report helps most.
The names of writers
Each section names its writer in drafted_by. A name such as writer@claude-opus-5-5 means a model role of the agent wrote the draft (spec 14.5). The handbook says this openly. A model draft is checked by scripts and by people before it is reviewed, in the same way as a draft by a person.
Numbers and citations
The handbook numbers its items so that you can cite each one exactly. TAOCP has its own numbers too. This section shows both kinds of number and how to write them.
The numbers of the book
The handbook writes the items of TAOCP in Knuth's own forms (spec 07.5):
| Item | Form | Example |
|---|---|---|
| exercise | section, a hyphen, the number | exercise 1.2.6-42 |
| numbered equation | section and number in parentheses | eq. 1.2.6(21) |
| algorithm | section and letter | Algorithm 1.1E |
| program | section and letter | Program 1.3.2P |
| theorem, lemma, corollary | section and letter | Theorem 1.2.4F |
Knuth reuses letters in different sections, so the section is always part of the name. Algorithm 2.3.1T and Algorithm 2.3.2T are different algorithms.
Example. "Exercise 5.1.3-7" is exercise 7 at the end of Section 5.1.3, in Volume 3. "Eq. 5.1.3(7)" is the seventh numbered equation in the text of the same section. Do not mix them up.
Example. The sample exercises in the Notes on the Exercises of Volume 1 have no section. The project names them V1-NE-1 to V1-NE-4. The exercises of Mathematical Preliminaries Redux in Volume 4B are named MPR-1, MPR-2, and so on.
The numbers of the handbook
An item of the handbook has the number of its volume, its chapter and its place in the chapter. The builder thb writes these numbers. A writer never types them by hand.
| Volume | Form | Example |
|---|---|---|
| a P volume | volume, chapter, item | Theorem P2.6.35 |
| a C volume | volume, section of TAOCP, item | Theorem C1.1.2.6.3 |
| an X volume | the number of the exercise in the book | exercise 1.2.6-42 in X1 |
| an exercise of a P volume | chapter, section, a hyphen, the number | Exercise 2.1-5 of P2 |
Example. "Theorem C1.1.2.6.3" is the third numbered item of the chapter of C1 that follows Section 1.2.6. The part "1.2.6" is the section of the book, so the number tells you where to look in TAOCP as well.
Example. The solution of exercise 1.2.6-42 in X1 has the same number as the exercise in the book. It also has a file name, x1-solutions-vol1/s1_2_6/42.md, and a page on the site, /ex/1.2.6/42/.
How to cite
To cite a result, give the number and the volume of the handbook, and the release when it matters. For a result of the book, give Knuth's number and the volume of TAOCP.
Example. In a course note, write: "By Vandermonde's convolution (TAOCP eq. 1.2.6(21); see the handbook, P2 Ch. 7) the sum equals ." A reader of the note can find the identity in both books.
Example. In a bug report on the handbook, write the full number, the release and the line: "P2, release 0.1.0, Theorem P2.6.35, the display: the lower index of the last term." The maintainers can find the line at once.
How to report an error
The handbook will have errors. A report helps every later reader. This section says what to report, where, and what happens next. It is about errors in the handbook. Errors in TAOCP itself follow a separate rule, which Chapter 6 describes.
What to report
Report anything that is wrong or unclear:
- a wrong number in an example or a check;
- a step of a proof that does not follow;
- a wrong reference to an item of the book or of the handbook;
- a Lean name that does not exist or does not say what the text says;
- a sentence that you cannot understand after two readings.
Example. A worked example in P2 says that . You compute . This is a wrong number. Report the item number, the line and the correct value.
Example. A proof in a companion section says "by the addition formula" and the step needs the symmetry law instead. The result is still true, but the reason is wrong. Report it too. A wrong reason misleads a student as much as a wrong result.
Where to report
Open an issue in the repository of the handbook, tamnd/taocp-handbook, on GitHub. Give:
- the volume and the number of the item, for example "P2, Theorem P2.6.35";
- the release or the date of the build, from the first page or the foot of the web page;
- what is wrong, in one or two sentences;
- the correction, if you know it, with the computation or the argument.
If the error is in a Lean statement or in the status of a node, open the issue in the repository of the map, tamnd/taocp, or use the form on the page /errata/ of the site. A statement that does not say what the book says is the most serious kind of error in the project (spec 06.9).
Do not quote long parts of the book in a report. Give the number of the item, as the handbook does.
Example. A report reads: "C1, Section 1.2.6, part 5, the table of exercises. Exercise 1.2.6-38 is listed as M30. My copy (third edition) has HM30." The maintainer checks the copy of the project and the errata list, and fixes the table or the record of the node.
What happens next
A maintainer reads the report, checks it, and answers. A correct report leads to a change in the next build. The change is listed in the file CHANGELOG.md of the handbook. If the error was in a reviewed section, the reviewer is told, and the section is reviewed again.
Example. A report shows that a check value in X1 is wrong for . The maintainer runs the lab check again, finds that the value in the text was mistyped, and corrects it. The next build has the right value, and the changelog has a line for it.
Things to try
- Choose your reading path from the table of Section 3.2, and write down the first five chapters that you will read.
- Open the front matter of one section of P2 in the repository of the handbook. Find the keys
requires,reads_withandstatus, and say what each one tells you (Sections 3.1 and 3.4). - Take an exercise of Section 1.2.3 rated about 20. Work it with the plan of Section 2.2, and use the hints of X1 one at a time when they exist (Section 3.3).
- Write the citation of eq. 1.2.3(14) and of the result of P2 that proves it, in the forms of Section 3.5.
- Find one sentence of this volume that you would write in a clearer way, and send it as an issue (Section 3.6).
The handbook is large. Its three series have about 9,000 pages in plan, and no reader needs all of them. This chapter shows how the parts fit, how to choose a path through them, and how to read the signs on each page: the hints, the status lines and the numbers.
Section 3.1 describes the three series and how a companion section points back to the P volumes and forward to the Solutions volume. Section 3.2 gives the reading paths and helps you choose one. Section 3.3 explains the graded hints and how to use them one at a time. Section 3.4 explains the status lines drafted, checked and reviewed. Section 3.5 explains the numbers of items and exercises, and how to cite them. Section 3.6 says how to report an error in the handbook.
The path "Volume 1 course" reads Chapters 1 to 3 of this volume. Every other path reads them too.
The source of this page. Something is wrong? Report it.