Prerequisites


This book starts from scratch on every mathematical topic — logic, sets, proof, counting, graphs, number theory. What it assumes is a little high-school algebra, the ability to read simple code, and a willingness to think carefully. This page helps you check your readiness and points you to quick refreshers for any gaps. None of these gaps should stop you from starting — they just tell you where to go a little slower.


1. Algebra and precalculus

You should be comfortable manipulating symbols. Specifically:

  • Variables and expressions: expand and factor, e.g. $(k+1)^2 = k^2 + 2k + 1$.
  • Fractions: combine over a common denominator, e.g. $\frac{k(k+1)}{2} + (k+1) = \frac{(k+1)(k+2)}{2}$.
  • Exponents: the rules $a^m a^n = a^{m+n}$ and $(a^m)^n = a^{mn}$, e.g. $2 \cdot 2^k = 2^{k+1}$.
  • Logarithms: what $\log_2 n$ means (the power of 2 that gives $n$) and that it grows slowly.
  • Functions and graphs: reading $f(x)$ and recognizing linear vs. polynomial vs. exponential growth.

Self-check (algebra)

Try these without a calculator:

  1. Expand $(n+1)(n+2)$.
  2. Simplify $\frac{n^2 - 1}{n - 1}$ for $n \ne 1$.
  3. What is $\log_2 1024$?
  4. Is $2^n$ eventually larger than $n^{10}$ as $n$ grows? (Intuition is enough.)

Answers: (1) $n^2 + 3n + 2$; (2) $n + 1$; (3) $10$; (4) yes — exponential growth eventually overtakes any polynomial. If 3 of 4 felt comfortable, you're ready. If not, see the refresher in appendices/appendix-d-math-foundations-refresher.md.

💡 Note: You do not need calculus. There is one optional connection to continuous math late in the book, clearly marked as optional.

2. Programming

You should be able to read short programs and understand what they do. You do not need to be a strong programmer, and you do not need to know Python specifically — it is taught as it appears. You should recognize:

  • Variables and assignment, and basic types (integers, strings, lists).
  • Conditionals (if/else) and loops (for, while).
  • Functions: defining one, calling one, returning a value.
  • The idea of recursion (a function that calls itself) — even if it still feels mysterious; Chapters 6 and 7 will make it solid.

Self-check (programming)

Read this and predict the output:

def mystery(n):
    total = 0
    for i in range(1, n + 1):
        total = total + i
    return total

print(mystery(4))

Answer: 10 (it computes $1+2+3+4$). If you could trace that, you have enough programming to begin. If range, loops, or functions are unfamiliar, any "Python in an afternoon" tutorial will close the gap; appendices/appendix-b-python-setup-and-reference.md lists good ones and shows you how to set up Python.

3. Mathematical maturity (the real prerequisite)

The honest prerequisite for discrete math is not a topic — it is a habit of mind: the willingness to read a precise definition carefully, to follow a chain of reasoning step by step, and to be bothered when something doesn't quite follow. You are not expected to have this skill yet; building it is one of the main things this book teaches. But you should arrive willing to practice it. When a sentence says "for all integers $n$," that word all is doing real work, and noticing that is the beginning of mathematical thinking.

Self-check (reasoning)

A friend claims: "Every odd number is prime — look, 3, 5, 7 are all prime." Is the claim true? If not, what is the smallest counterexample?

Answer: False; the smallest counterexample is $9 = 3 \times 3$ (odd but not prime). If you can find a single counterexample and see that it settles the question, you already think the way this book will sharpen.


Technical setup (optional)

You can read the whole book with no software — every code example shows its output. To run the code:

  • Python 3.10 or later (from python.org, or via Anaconda/Miniconda).
  • A code editor — VS Code, PyCharm, or JupyterLab.
  • The libraries, installed once:
pip install -r requirements.txt

Verify your setup:

python --version     # should print 3.10 or higher
python -c "import networkx, sympy, numpy; print('ready')"

Full setup help, including troubleshooting, is in appendices/appendix-b-python-setup-and-reference.md.


If you're not quite ready

Don't be discouraged — gaps are normal and fixable.

  • Algebra rusty? Spend a few hours with Appendix D and a free resource like Khan Academy's algebra track. You need fluency, not mastery.
  • New to programming? Do a short Python intro first (a weekend is plenty for what this book needs).
  • Never written or read a proof? Perfect — that's what Part I is for. Just start at Chapter 1 and trust the scaffolding.

"The best time to start was yesterday. The second best time is now." Turn the page.