THE READING ROOM / BOOK GUIDE
Mathematics for Computer Science
A free textbook on proofs, discrete structures and probability for readers who need mathematical reasoning to hold up in software work. Three authors with MIT ties wrote it, and it has been revised through years of classroom use.
About the book
Mathematics for Computer Science is a collaboratively written textbook by Eric Lehman, F. Thomson Leighton and Albert R. Meyer. It covers the mathematical foundations under computer science: logic and proof technique, sets and relations, graphs, counting, number theory and discrete probability. The book grew out of teaching at MIT and has circulated in successive free revisions rather than as a fixed commercial edition, which shapes how a reader should approach it.
Proof is the organizing commitment. Definitions are stated, claims are proved, and the reader is expected to follow arguments rather than accept results on authority. That makes it a working text. The mathematics is there to be used in reasoning about algorithms, data structures and probabilistic systems.
The treatment is broad rather than deep in any single branch. Topics are introduced with enough formality to support later work, and the emphasis falls on technique and on the habits of careful argument. Readers who want one narrow subject treated exhaustively should look elsewhere. This is a foundation text with range.
How to read it
Read with paper nearby. The proofs invite reconstruction, and the material rewards readers who stop to supply a missing step or test a claim with a small example. Skipping the exercises removes most of the value.
Difficulty rises unevenly. Early logic and proof material is accessible to a motivated beginner. Probability and some number-theoretic arguments demand more patience. Expect to move slowly through the later sections and to revisit definitions when an argument stops making sense.
The text exists in multiple free revisions, so section numbering and some examples differ between copies. Note which version you are reading if you discuss it with others, and check that your copy includes the topics you need before committing.
Who it suits
Suited to computer science students, self-taught programmers and working engineers who want the mathematical vocabulary behind correctness arguments, complexity reasoning and randomized algorithms. It also serves readers preparing for graduate study or for courses that assume discrete mathematics. Those who prefer worked examples over proof will find it demanding but usable if they pair it with practice problems.
Reading considerations
The book is a teaching text, not a reference manual, and its coverage of any one area is introductory. Readers seeking advanced treatment of probability or graph theory will need a second source. Freely distributed versions vary in content and numbering, so confirm the revision you hold, and do not treat the text as a substitute for a course's own syllabus.
Follow the HN conversation
37 different recommenders are recorded in the upstream dataset. These are AI-classified source counts, not an independent rating.
Search HN comments about this book ↗
Explore videos on the same subject ↗
Book notes prepared with DeepSeek, using catalogue records and Open Library subject information. They are reading guidance, not a personal review or a verified chapter-by-chapter account. Book details can vary by edition. HN data methodology · Book metadata and covers.
