Best Discrete Math Books for Computer Science Students
Discrete math is where CS students either build real foundations or start faking it. I know that sounds harsh.
But I’ve watched it happen too many times. Someone struggles with algorithm complexity, can’t follow a correctness proof, freezes during a graph theory interview question… and every time, it traces back to the same root cause. They checked the discrete math box without actually learning the material.
Your textbook choice matters more than you’d think. Most discrete math books are written by pure mathematicians who are brilliant at math and terrible at explaining it to someone seeing proofs for the first time. You finish a chapter and still can’t construct a proof from scratch.
I’ve been pointing students toward math and CS resources on this site since 2008. I’ve seen people burn entire semesters with the wrong book and accelerate with the right one. So here are 9 discrete math books I’d actually put in front of a student. Some cost $170+. Two are completely free. I’ll tell you exactly when free is good enough.
| Book | Best For | Price | Free? |
|---|---|---|---|
| Rosen — Discrete Mathematics and Its Applications | Overall pick | ~$170 | No |
| Epp — Discrete Mathematics with Applications | Learning proofs | ~$130 | No |
| Levin — Discrete Mathematics: An Open Introduction | Budget / self-study | Free | Yes |
| Lehman, Leighton & Meyer — Mathematics for Computer Science | CS-specific focus | Free | Yes |
| Graham, Knuth & Patashnik — Concrete Mathematics | Advanced students | ~$65 | No |
1. Discrete Mathematics and Its Applications by Kenneth Rosen
Discrete Mathematics and Its Applications (8th Edition)
- Covers logic, proofs, sets, graph theory, combinatorics, and Boolean algebra
- 4,000+ exercises from routine to challenging with selected answers
- Used at 600+ universities worldwide
- 8th edition adds more CS-specific applications
- Massive online ecosystem of solutions and walkthroughs
If you’re buying one discrete math textbook, make it Rosen. Not the easiest read, but the exercise quality and the ecosystem around it (YouTube walkthroughs, solution wikis, professor notes) make it the safest long-term pick for CS students.
If one discrete math textbook could be called “the” textbook, it’s this one. Now in its 8th edition, Rosen has been the default assignment at hundreds of universities for two decades. There’s a reason for that, even if the reason isn’t “it’s fun to read.”
Coverage is everything you’d expect: logic, proofs, sets, functions, sequences, counting, relations, graph theory, trees, Boolean algebra. The 8th edition added more CS applications, which makes the connection between abstract concepts and actual programming much clearer than older editions.
The exercises are where this book earns its price. Over 4,000 problems, from routine to genuinely hard. Selected answers in the back, full solutions manual sold separately. If you learn by working problems (and in discrete math, you should), the exercise set alone justifies the cost.
The downside? Readability. Rosen writes like a mathematician explaining to other mathematicians. Dense. Precise. If you’re seeing formal proofs for the first time, some sections will feel like a foreign language. You’ll read paragraphs twice, work the examples yourself, and need patience.
Pricing hurts. About $170 for the hardcover new. Used copies and rentals bring it to $40-80 depending on condition. If your university assigns Rosen, buy it used from one of the best online bookstores. If you’re self-studying, honestly, try the free alternatives below first. Come back to Rosen as a reference.
What makes Rosen hard to beat is the ecosystem. YouTube channels, solution wikis, study guides, professor lecture notes all reference Rosen by chapter and section number. When you’re stuck on a problem at 2 AM, that ecosystem is what saves you.
2. Discrete Mathematics with Applications by Susanna Epp
Discrete Mathematics with Applications (5th Edition)
- Exceptional proof methodology — teaches thinking process, not just mechanics
- Covers logic, proofs, sets, functions, relations, graphs, trees, counting
- Examples come before formal definitions for better learning flow
- More accessible writing style than Rosen
- Available in hardcover and ebook formats
Epp does something most discrete math textbooks don’t even attempt. She teaches you how to think about proofs before asking you to write them.
The first few chapters build proof skills gradually. Logic first, then direct proofs, contradiction, induction, each with more scaffolding than any other text on this list. Epp explains not just the mechanics but the thought process behind choosing which technique to use. For students who find Rosen’s proof chapters impenetrable… this is usually the fix.
Coverage: logic, proofs, sets, functions, relations, graphs, trees, counting. Not as encyclopedic as Rosen. You won’t find as many CS applications or as deep a number theory treatment. But the trade-off is clarity. What Epp covers, she covers well.
The writing is accessible in a way that Rosen isn’t. Shorter sentences. Examples before formal definitions, not after. You can tell someone planned how students would actually encounter each concept.
The 5th edition is current. Around $130 new, cheaper used. If your course assigns Epp, you’re in good hands. If you’re choosing between Epp and Rosen for self-study and proofs intimidate you, go Epp.
One limitation: fewer exercises than Rosen. The problems are well-designed but there aren’t enough of them. If you need 50 practice problems per topic to feel confident, supplement with one of the math apps and digital tools that offer extra practice.
I’d pick this over Rosen if proofs are your weak spot. It won’t give you the encyclopedic reference Rosen provides, but it’ll teach you the skill that matters most in discrete math: how to construct a proof when you’re staring at a blank page.
3. Discrete Mathematics: An Open Introduction by Oscar Levin
Discrete Mathematics: An Open Introduction (4th Edition)
- Completely free and open source under Creative Commons license
- Covers counting, sequences, logic, graph theory, and proof techniques
- Investigate! activities encourage exploration before formal proofs
- Print copy available for ~$20 if you prefer physical books
- Interactive online version with embedded exercises
“Do I really need to spend $170 on a discrete math textbook?”
I get this question constantly. For many students, the honest answer is no. Levin’s book is completely free and open source. Read it online, download the PDF, or order a print copy for about $20 if you want something physical. Now in its 4th edition, used at over 200 colleges and universities.
The writing is clear and conversational. Levin teaches at the University of Northern Colorado and wrote this for his own students. That shows. It reads like someone who has actually watched students struggle with specific concepts and adjusted the explanations accordingly.
Scope is narrower than Rosen or Epp. No number theory, no recursion theory, no Boolean algebra. For a typical one-semester course, that’s fine. For a two-semester sequence or anything deep into combinatorics, you’ll need to supplement.
The exercises include “Investigate!” activities that encourage you to explore before jumping into formal proofs. Works well if you don’t have a professor guiding the discovery process. Hints and answers included.
If you’re studying on a laptop anyway, use the web version. It has interactive elements the PDF can’t match.
Look, for a one-semester intro course? This book is genuinely good enough. Save your money.
4. Mathematics for Computer Science by Lehman, Leighton & Meyer
Mathematics for Computer Science (MIT OpenCourseWare)
- Built for MIT's 6.042J/6.1200J — designed ground-up for CS students
- Strong probability chapter (rare in discrete math texts)
- 900+ pages covering proofs, graph theory, counting, and probability
- Free MIT OCW lecture videos pair with the text
- Connects math directly to algorithms and data structures
MIT’s own discrete math textbook, built for their 6.042J course (now numbered 6.1200J). Free, rigorous, and built from the ground up for CS students.
The CS focus is what sets it apart. Graph theory connects directly to algorithms and data structures instead of staying abstract. Probability gets serious treatment here, which most discrete math texts either skip or bury in a single chapter. If you’re heading toward algorithms, ML, or systems courses, the probability coverage alone is worth your time.
The writing is more technical than Levin but less dry than Rosen. Co-author Tom Leighton co-founded Akamai, so he knows how math applies to real CS problems. That practical lens shows throughout.
Fair warning: 900+ pages. That’s because it covers material other schools split across two or three courses. Don’t read it cover to cover. Prioritize proofs, graph theory, counting, and probability for a typical CS path.
No print edition from a major publisher. You’re reading a PDF or printing it yourself. The exercise sets aren’t as polished as Rosen’s, and there’s no official solutions manual. For some students, that’s a dealbreaker.
The real power move? Combine this book with the MIT OCW lecture videos. That combo is one of the strongest free resources in CS education. If you prefer more structure, a Coursera discrete math course adds deadlines and grading, which helps if you need external motivation.
This is the book for CS students who keep asking “when will I use this?” It answers that question on almost every page.
5. Concrete Mathematics by Graham, Knuth & Patashnik
Concrete Mathematics: A Foundation for Computer Science (2nd Edition)
- Co-authored by Donald Knuth — bridges discrete math and algorithm analysis
- Covers sums, recurrences, number theory, binomial coefficients, generating functions
- Real student margin notes add humor and warn about common mistakes
- Best value among paid books at ~$65 paperback
- 2nd edition (1994) — still current because the math doesn't age
OK, this one is different. Written by Donald Knuth (yes, that Knuth), Ron Graham, and Oren Patashnik, Concrete Mathematics bridges discrete math and the analysis you need for serious algorithm work. The title mashes “continuous” and “discrete” together, which tells you the approach. This book doesn’t stay neatly in any one lane.
Coverage: sums, recurrences, integer functions, number theory, binomial coefficients, generating functions, discrete probability. If that list sounds like exactly what you need for analyzing algorithms, that’s because this book grew out of Knuth’s The Art of Computer Programming.
The writing has personality. Margin notes include actual student comments from Stanford classes, jokes, warnings about common mistakes. Dense material with a sense of humor. Rare for math textbooks.
Don’t start here. If formal proofs and basic combinatorics are still new to you, this book will crush you. It assumes mathematical maturity that takes a semester or two to develop. Read this after your first discrete math course, not as your first.
At about $65 for the paperback, it’s the best value on this list. The 2nd edition has been current since 1994. Doesn’t need updating because the math doesn’t change. Thirty years later, algorithm designers still reach for it.
If you’re heading into algorithms research, competitive programming, or just want to understand complexity analysis at a deeper level, this is the book. At $65, honestly, it outperforms books three times its price.
6. Discrete Mathematics: Elementary and Beyond by Lovasz, Pelikan & Vesztergombi
Discrete Mathematics: Elementary and Beyond (Springer UTM)
- Co-authored by Abel Prize winner Laszlo Lovasz
- Concise at ~290 pages — covers combinatorics, graph theory, sets
- Includes advanced topics like Ramsey theory and combinatorial geometry
- Springer UTM series — affordable at ~$40 paperback
- Creative exercises that emphasize thinking over grinding
Laszlo Lovasz won the Abel Prize, which is the closest thing math has to a Nobel. When he co-writes a discrete math book, the result doesn’t look like a typical American textbook.
This Springer UTM book is concise. About 290 pages. Covers combinatorics, graph theory, sets, plus a few advanced topics like Ramsey theory and combinatorial geometry. Elegant rather than exhaustive. Instead of ten examples per proof technique, the authors show you how mathematicians actually think about problems.
The writing assumes more math maturity than Rosen or Epp. No hand-holding through basic logic. But if you already have some foundations, the clarity is remarkable. What takes Rosen 10 pages, Lovasz covers in 3 without losing rigor.
About $40 for the paperback. No ebook DRM headaches.
The limitation: scope. No logic chapter. No formal treatment of proof methods. No probability. This works as a second book or supplement, not as your only text. If your course covers logic and proofs heavily, you’ll need another resource.
Exercises lean creative rather than routine. Less grinding, more thinking. If you’re the type who visits math help websites to discuss interesting problems, you’ll appreciate the style. If you need 50 repetitive drills to feel confident… this isn’t your book.
7. Discrete Mathematics by Richard Johnsonbaugh
Discrete Mathematics (8th Edition) by Johnsonbaugh
- More worked examples per concept than any other book on this list
- Covers logic, proofs, counting, graphs, trees, Boolean algebras
- CS applications woven throughout with algorithm examples
- Step-by-step demonstrations before each exercise set
- Available in hardcover and ebook formats
Johnsonbaugh takes the “learn by example” approach further than anything else on this list.
Every concept comes with multiple worked examples before the exercises. If your learning style is “show me how it’s done three times, then let me try,” this book matches that perfectly. The 8th edition covers logic, proofs, counting, relations, digraphs, graphs, trees, network models, Boolean algebras.
The writing is clear but unremarkable. It doesn’t have Epp’s pedagogical insight or Lovasz’s elegance. What it has is volume. More examples, more solved problems, more step-by-step demonstrations. For students who need to see a technique applied multiple times before they can do it themselves, this repetition is the feature.
CS applications are woven in throughout. Algorithm examples in most chapters. The graph theory and tree sections connect directly to data structures, and those connections feel more natural than Rosen’s sometimes-forced examples.
The price is steep at ~$150 new. At that price, Rosen gives you more. If you’ve tried Rosen and found it too dense, Johnsonbaugh might be worth it. Better yet, grab the used 7th edition. Same core material, fraction of the price.
Honorable Mentions
Two more that didn’t make the main list but deserve a look.
Mathematics: A Discrete Introduction by Edward Scheinerman
Scheinerman’s entire first section focuses on how to read, write, and structure proofs. If Epp’s approach doesn’t click for you, try this one alongside your primary text. The 3rd edition runs about $120 new. Check price on Amazon.
Discrete and Combinatorial Mathematics by Ralph Grimaldi
Grimaldi’s 5th edition is reference-grade. Deep combinatorics, thorough recurrence relations, massive exercise set. Out of print but available used. Best as a shelf reference, not a first textbook. If you’re specializing in combinatorics or theoretical CS, hunt down a used copy. Find used copies on Amazon.
How to Choose the Right Discrete Math Book
Most students overthink this. Here’s what actually matters.
Your Course Requirements
If your professor assigns a textbook, get it. Fighting your course’s assigned text wastes more energy than it saves. You need the exercises that map to homework. Supplement with a second book if the primary one isn’t clicking, but don’t skip it.
Your Math Background
Be honest with yourself. Comfortable with algebra and have seen proofs before, even in high school geometry? Start with Rosen, Epp, or the MIT text. Proofs completely new? Start with Epp or Levin. They build foundations Rosen assumes you have. If you need a refresher first, check out these algebra books.
Self-Study vs. Course Companion
Self-studiers should try the free options first. Levin and the MIT text are good enough for a first pass through discrete math. Save the $170.
If you’re supplementing a course, pick a book with a different teaching style. Using Rosen in class? Supplement with Epp for proof clarity. Using Epp? Add the MIT text for CS applications. Two perspectives beat reading one explanation twice.
Budget
Discrete math textbooks range from free to $170+. Expensive doesn’t mean better. Rosen dominates because of university adoption, not because it’s four times better than a free alternative.
Previous editions of Rosen or Epp cover 95% of the same material for a fraction of the cost. The core math hasn’t changed. What changes between editions is the CS examples and exercise numbering. Browse the best online bookstores for used copies before paying retail.
Red Flags to Watch For
- “Discrete math for beginners” books that skip proofs entirely (you need proofs for CS, period)
- International editions with different exercise numbering (makes following your course nearly impossible)
- Loose-leaf “binder ready” versions that fall apart within a semester
- Any book whose last edition predates 2005 with no revision in sight
When Free Is Enough
For a one-semester intro course covering logic, proofs, counting, and graph theory? Free is enough. Levin or the MIT text will get you through.
Paid textbooks earn their price in three situations: you need encyclopedic coverage with massive exercise sets (Rosen), you need exceptional proof pedagogy (Epp), or you need advanced material for algorithm analysis (Concrete Mathematics). If none of those apply, start free. You can always buy later. You can’t un-buy a $170 textbook collecting dust on your shelf.
Full Comparison
| Feature | Rosen | Epp | Levin | MIT (Lehman et al) | Concrete Math | Lovasz et al | Johnsonbaugh |
|---|---|---|---|---|---|---|---|
| Price | ~$170 | ~$130 | Free | Free | ~$65 | ~$40 | ~$150 |
| Logic & Proofs | Yes | Yes (strong) | Yes | Yes | Assumed | Minimal | Yes |
| Graph Theory | Yes | Yes | Yes | Yes | No | Yes (strong) | Yes |
| Combinatorics | Yes | Yes | Yes | Yes | Yes (strong) | Yes (strong) | Yes |
| Probability | Limited | Limited | No | Yes (strong) | Yes | No | Limited |
| Number Theory | Yes | Limited | No | Yes | Yes (strong) | Limited | Limited |
| Exercise Count | 4,000+ | ~2,500 | ~800 | ~1,500 | ~500 | ~400 | ~3,000 |
| Best Level | All levels | Beginner | Beginner | Intermediate | Advanced | Intermediate | Beginner |
If you’re studying for cybersecurity, pay attention to the number theory column. Cryptography relies heavily on discrete math concepts that only Rosen, the MIT text, and Concrete Mathematics cover in depth.
Frequently Asked Questions
Do I need a discrete math textbook if my course has lecture notes?
Yes, for the exercises. Lecture notes rarely have enough practice problems. Rosen has 4,000+ problems. You won’t get that density from notes alone. Even if you attend every lecture, you need a problem source.
Can I use an older edition to save money?
Almost always yes. The 7th edition of Rosen covers the same logic, proofs, and graph theory as the 8th. Core math doesn’t change. What changes: some CS examples and exercise numbering. Check with your professor if homework is assigned by problem number from a specific edition.
Is Concrete Mathematics a good first discrete math book?
No. Great as a second or third book. It assumes mathematical maturity that takes a semester or two to build. Start with Rosen, Epp, or a free option. Come back to Concrete Mathematics when you’re ready for algorithm analysis.
What’s the best free discrete math textbook?
For self-study with no math background: Oscar Levin’s Discrete Mathematics: An Open Introduction. For CS students with some foundation: the MIT Mathematics for Computer Science text. Both are high quality. Levin is better as a first course companion. The MIT text is better for CS-connected applications, especially probability.
Do I need to read the whole textbook cover to cover?
No. Focus on what your course covers. For a CS path, prioritize logic and proofs, sets and functions, combinatorics, and graph theory. Number theory matters for cryptography. Probability matters for algorithms courses. Skip what your path doesn’t require.
Which discrete math book is best for coding interview preparation?
The MIT text connects most directly to interview topics. For graph theory, any book’s graph chapters will help. But for interview prep specifically, you’ll get more from an algorithms textbook like CLRS or Skiena’s Algorithm Design Manual. Discrete math gives you foundations. Algorithms books give you the patterns interviewers actually test.
Are international editions worth buying?
Cheaper, but with trade-offs. Exercise numbering may differ, page numbers won’t match your course, content may be rearranged. For self-study where you don’t need to match a syllabus, they’re fine. For courses that assign homework by problem number, they’ll cause headaches.
My recommendation: start with Levin’s free textbook or the MIT text. If you need more depth or your course requires it, get Rosen used. When you’re ready to go deep on algorithm analysis, Concrete Mathematics at $65 is the best investment on this list.
Disclaimer: This site is reader‑supported. If you buy through some links, I may earn a small commission at no extra cost to you. I only recommend tools I trust and would use myself. Your support helps keep gauravtiwari.org free and focused on real-world advice. Thanks. — Gaurav Tiwari