Discrete Mathematics
Discrete mathematics supplies the language used to reason about programs and algorithms. The durable sequence is:
- propositions, predicates, and proof techniques;
- sets, functions, and relations;
- induction and recursion;
- counting and combinatorial proofs;
- graphs and trees;
- discrete probability.
This page is a starting reference for proofs and finite structures, not a complete course in combinatorics or graph theory. Berkeley CS 70 develops the proof and probability sequence; concrete algorithm notes live in Computer Science.
Statements and proofs
A proposition is true or false; a predicate such as becomes a proposition once its variable is specified or quantified. A universal claim needs an argument covering every allowed ; one counterexample disproves it. An existential claim needs only one witness. The domain matters: “every number has a multiplicative inverse” is false for the reals because of zero, but true for nonzero reals.
An implication does not imply its converse . Its contrapositive is equivalent. For integer , “ is even implies is even” follows by writing , giving . Testing several even numbers would illustrate, not prove, the claim.
Induction proves for all integers by proving a base case and showing that implies . For , the base holds. Adding to the assumed sum gives , establishing the next case. A loop invariant uses the same pattern: initialization, preservation by one iteration, then a conclusion on exit. Termination still requires a separate argument, such as a nonnegative integer measure that strictly decreases.
Count the objects you actually mean
A set has distinct, unordered members. A function assigns each input exactly one output; a relation is a set of pairs and need not do so. Counting depends on whether order and repetition matter:
Here are nonnegative integers, with for choices without repetition, and . The empty choice counts once; in this counting formula, . Choosing two distinct people from five gives 20 assignments to two distinct roles, but only 10 two-person committees: each committee was counted in both orders. Counts become probabilities by dividing by the total only when the elementary outcomes are equally likely.
Graphs, trees, and finite games
A graph consists of vertices and edges. State whether edges are directed and whether loops or repeated edges are allowed. A finite simple undirected tree is connected and has no cycles; with vertices it has edges and a unique simple path between any two vertices. The edge count alone does not prove a graph is a tree: a triangle plus an isolated vertex has four vertices and three edges but is disconnected.
A game tree represents histories, not merely distinct board positions: different histories may reach the same position. Winning strategies in finite games uses induction, invariants, and trees to distinguish proving that a strategy exists from constructing and executing it.