Discrete mathematics for computer science
The mathematical toolkit behind algorithms and logic. Every topic has worked examples you can check by hand, then an interactive version that computes the same thing.
- Explainer
Sets, relations and functions
Shade any set expression on a Venn diagram and test a relation for its properties.
Try it: Venn-diagram expression shader and relation-property checker - Explainer
Proof by induction
Four worked proofs revealed one step at a time, and a broken one to diagnose.
Try it: Step-reveal proofs and a numerical claim checker - Explainer
Combinatorics
An exact nPr and nCr calculator, and a Pascal’s triangle that shows its own addition rule.
Try it: nPr / nCr calculator with enumeration, and Pascal’s triangle - Explainer
Boolean algebra
The laws, De Morgan, and normal forms, with a truth-table generator built in.
Try it: Truth-table generator with CNF, DNF and equivalence checking
Why discrete maths?
Algorithms manipulate finite structures: sets of items, relations between them, sequences of choices, true-or-false conditions. Discrete mathematics is the language for reasoning about those structures precisely, and proof by induction is the main tool for showing that an algorithm is correct for every input, not just the ones you tested.
The four topics build on each other. Sets, relations and functions supply the vocabulary. Boolean algebra is the algebra of the same operations seen as logic. Combinatorics counts the objects, which is how you size a search space. Induction proves statements about all of them at once.
Related tools
The truth table generator handles any Boolean expression with up to eight variables and produces minimal normal forms and LaTeX.