Discrete Mathematics
1. Propositional and Predicate Logic
1.1 Propositional Logic
A proposition is a statement that is either true or false. Propositional logic deals with Propositions and their combinations using logical connectives.
Basic connectives:
| Symbol | Name | Meaning |
|---|---|---|
| Negation | NOT | |
| Conjunction | AND | |
| Disjunction | OR | |
| Implication | IF…THEN | |
| Biconditional | IF AND ONLY IF |
Truth tables. The implication is false only when is true and is false.
Logical equivalence. Two propositions are logically equivalent () if they have the Same truth value for all assignments.
Important equivalences:
- (De Morgan)
- (De Morgan)
1.2 Predicate Logic
Predicates extend propositional logic with variables and quantifiers.
- Universal quantifier: — ” holds for all .”
- Existential quantifier: — “there exists such that holds.”
Negation of quantifiers:
Nested quantifiers must be read carefully. The order matters:
The first says “for every there is a (possibly different) .” The second says “there exists a Single that works for all .“
1.3 Validity and Satisfiability
A formula is valid (a tautology) if it is true under all interpretations. A formula is satisfiable if it is true under at least one interpretation.
Theorem 1.1. A formula is valid if and only if its negation is unsatisfiable.
1.4 Truth Table Construction Methods
For a propositional formula with distinct variables, the truth table has rows (one per Assignment). Two systematic methods ensure no assignment is missed.
Method 1: Binary counting. Treat the first variable as the most significant bit. Enumerate all Binary -tuples from to . The first variable changes most slowly (only every rows), while the last variable alternates every row.
Method 2: Recursive splitting. For variables, the table splits into two blocks of Rows: the top block has the first variable as The bottom as . Recurse on the remaining variables within each block.
Worked Example. Construct the truth table for .
Solution
With 3 variables we have rows.
| T | T | T | T | T | T |
| T | T | F | T | F | F |
| T | F | T | F | T | F |
| T | F | F | F | T | F |
| F | T | T | T | T | T |
| F | T | F | T | F | F |
| F | F | T | T | T | T |
| F | F | F | T | T | T |
The formula is satisfiable (e.g., ) but not a tautology (e.g., ).
Worked Example. Verify that hypothetical syllogism is a tautology.
Solution
Extending the table above:
| T | T | T | T | T | T |
| T | T | F | F | F | T |
| T | F | T | F | T | T |
| T | F | F | F | F | T |
| F | T | T | T | T | T |
| F | T | F | F | T | T |
| F | F | T | T | T | T |
| F | F | F | T | T | T |
The final column is all Confirming the tautology.
1.5 Natural Deduction
Natural deduction is a proof system that mirrors ordinary mathematical reasoning. Each connective Has introduction rules (how to derive a formula with that connective) and elimination rules (how to use a formula with that connective).
Rules of inference:
| Rule | Premises | Conclusion |
|---|---|---|
| -I | , | |
| -E | ||
| -E | ||
| -I | ||
| -I | ||
| -E | , , | |
| -I | ||
| -E | , | |
| -I | ||
| -E | , | |
| DNE | ||
| RAA |
Square brackets denote an assumption that is discharged after the rule is applied.
Worked Example. Prove: (contraposition).
Solution
- — premise
- — assumption (for -I)
- — assumption (for -I)
- — -E on 1, 3
- — -E on 4, 2
- — -I on 3—5, discharging
- — -I on 2—6, discharging
Worked Example. Prove: (disjunctive syllogism).
Solution
- — premise
- — premise
- — assumption (left case for -E)
- — -E on 3, 2
- — ex falso on 4
- — assumption (right case for -E)
- — reiterate 6
- — -E on 1, 3—5, 6—7
Worked Example. Prove: (distribution).
Solution
- — premise
- — -E on 1
- — -E on 1
- — assumption (left case for -E on 3)
- — -I on 2, 4
- — -I on 5
- — assumption (right case for -E on 3)
- — -I on 2, 7
- — -I on 8
- — -E on 3, 4—6, 7—9
:::caution Common Pitfall In natural deduction, always track which assumptions are discharged. A common mistake is to use a Discharged assumption in a later step. Each discharged assumption is only valid within the scope Indicated by the rule that discharges it. :::
1.6 CNF and DNF
A literal is a propositional variable or its negation. A clause is a disjunction of literals. A term (or cube) is a conjunction of literals.
- Disjunctive Normal Form (DNF): a disjunction of terms, e.g. .
- Conjunctive Normal Form (CNF): a conjunction of clauses, e.g. .
Theorem 1.2. Every propositional formula is equivalent to a formula in CNF and to a formula in DNF.
Conversion to CNF:
- Eliminate and : And .
- Push inward using De Morgan”s laws and double negation () until every applies to a single variable.
- Distribute over : .
Conversion to DNF: Same steps 1—2; in step 3 distribute over instead.
Worked Example. Convert to CNF.
Solution
Step 1: No or to eliminate.
Step 2: No to push inward.
Step 3: Distribute over :
.
Since is a tautology we may simplify to .
Worked Example. Convert to CNF.
Solution
Step 1: Eliminate : .
Step 2: Push inward: .
Step 3: Distribute over : .
This is in CNF.
:::caution Common Pitfall Distributing over can cause exponential blowup. A DNF formula with terms can Produce up to clauses when converted to CNF. This exponential growth underlies the hardness Of many satisfiability problems. :::
1.7 Resolution
The resolution rule is a single inference rule that is refutation-complete for propositional Logic.
Resolution rule. From clauses and Derive the resolvent Where and are (possibly empty) sets of literals and is a propositional Variable.
Resolution refutation. To show that clauses entail clause :
- Add to the clause set.
- Repeatedly apply the resolution rule to derive new clauses.
- If the empty clause is derived, the entailment holds.
Theorem 1.3 (Refutation completeness). If a set of clauses is unsatisfiable, the empty clause Can be derived by resolution.
Worked Example. Show that entails .
Solution
Add the negation of the conclusion: clause (4) .
Clauses: (1) ; (2) ; (3) ; (4) .
Resolve (2) and (4) on : (5) . Resolve (1) and (5) on : (6) . Resolve (3) and (6) on : (7) . Resolve (7) and (4) on : (8) .
Since is derived, the entailment holds.
1.8 The SAT Problem
The Boolean satisfiability problem (SAT) asks: given a propositional formula Is there a Truth assignment that makes true?
Definition. An instance of SAT is a propositional formula. The answer is YES if is Satisfiable, NO otherwise.
k-SAT. A restricted version where the formula is in CNF and every clause has exactly Literals.
- 1-SAT: solvable in linear time (each clause is a single literal).
- 2-SAT: solvable in time using the implication graph and strongly connected components, where is the number of variables and the number of clauses.
- 3-SAT: NP-complete (Cook—Levin theorem, 1971). This was the first problem proven NP-complete.
Theorem 1.4 (Cook—Levin). SAT is NP-complete. Consequently, 3-SAT is also NP-complete.
SAT solvers (DPLL, CDCL) are widely deployed in hardware verification, software model checking, and AI planning. Modern solvers routinely handle instances with millions of variables.
:::caution Common Pitfall Do not confuse satisfiability with validity. A formula is satisfiable if it is true under some Assignment; it is valid (a tautology) if true under all assignments. Checking validity is Co-NP-complete, not NP-complete. :::
2. Sets, Relations, and Functions
2.1 Sets
Basic operations:
- Union:
- Intersection:
- Difference:
- Complement: (where is the universal set)
De Morgan’s Laws:
Power set: . If Then .
2.2 Relations
A binary relation from set to set is a subset of .
A relation on is:
- Reflexive: , .
- Symmetric: .
- Antisymmetric: and .
- Transitive: and (a,c) \in R$.
Equivalence relation: reflexive, symmetric, transitive. Partitions the set into equivalence classes.
Partial order: reflexive, antisymmetric, transitive. Written .
A Hasse diagram is a graphical representation of a finite poset : an element Is drawn below whenever (i.e., and ), and an edge is drawn From to whenever covers (there is no with ).
Worked Example. Show that on defined by iff is An equivalence relation. Describe the equivalence classes.
Solution
Reflexive: So for all .
Symmetric: If Then So Giving .
Transitive: If and Then So .
The equivalence classes are . There are exactly 5 equivalence classes, forming the quotient .
Worked Example. Let be divisibility on : iff . Verify this is a partial order and identify the cover relations.
Solution
Reflexive: for all . ✓
Antisymmetric: If and Then and for positive So Giving and Hence . ✓
Transitive: If and Then So . ✓
Cover relations ( covers when and no element lies strictly between):
- 12 covers 6, 4
- 6 covers 2, 3
- 4 covers 2
- 3 covers 1
- 2 covers 1
Reading from bottom to top the Hasse diagram is: at the bottom with edges to and ; connects up to and ; connects up to ; and connect up to at the top.
2.3 Functions
A function is a relation where each appears exactly once as a first element.
- Injective (one-to-one): .
- Surjective (onto): for every There exists with .
- Bijective: both injective and surjective.
Theorem 2.1. If and are finite sets, is:
- Injective if and only if .
- Surjective if and only if .
- Bijective if and only if .
Theorem 2.2 (Pigeonhole Principle). If Then no function is injective. Equivalently, placing items into boxes with forces at least one box to contain at least items.
Function composition. Given and The composition is defined by for all .
Theorem 2.3. If and are both injective, then is injective.
Proof. Suppose . Then . Since is Injective, . Since is injective, . Hence is injective.
Theorem 2.4. If and are both surjective, then is surjective.
Proof. Let . Since is surjective, with . Since is Surjective, with . Then . Hence is surjective.
Corollary 2.5. The composition of two bijections is a bijection.
A function is invertible if there exists such that f^{-1} \circ f = \mathrm{id{}_A and f \circ f^{-1} = \mathrm{id{}_B. A function is invertible If and only if it is bijective.
2.4 Countability
Definition. A set is countable if it is finite or countably infinite. A set is countably infinite if there exists a bijection . A set that is not countable Is uncountable.
Theorem 2.6. is countably infinite.
Proof. The function defined by
Is a bijection, enumerating
Theorem 2.7. is countably infinite.
Proof. Every positive rational can be written as with . Arrange the Pairs in an infinite grid and traverse them diagonally:
Skipping duplicates (where in reduced form) yields an enumeration of . Extending with negatives and zero gives an enumeration of .
Theorem 2.8 (Cantor, 1891). is uncountable.
Proof (Diagonal argument). Suppose for contradiction that is countable. Then the Interval can be listed as where each has a unique decimal Expansion with each (choosing the expansion that does not end in all 9s to avoid dual representations).
Define by
Then and differs from in the -th decimal place for every So Contradicting the assumption that the list was complete. Therefore is uncountable.
3. Proof Techniques
3.1 Direct Proof
To prove : assume Derive by a chain of logical deductions.
Example. Prove: if is odd, then is odd.
Proof. Let . Then Which is odd.
Worked Example. Prove: the sum of any two rational numbers is rational.
Solution
Let and where and . Then
Since and The sum is rational.
3.2 Proof by Contrapositive
To prove : prove instead.
Example. Prove: if is even, then is even.
Proof. Contrapositive: if is odd, then is odd. This was proved above.
Worked Example. Prove: if is odd, then is odd.
Solution
Contrapositive: if is even, then is even.
Let . Then Which is even.
3.3 Proof by Contradiction
To prove : assume and derive a contradiction.
Example (Euclid). There are infinitely many primes.
Proof. Suppose there are finitely many primes . Consider . is not divisible by any (it leaves remainder 1). So is either prime itself or has a prime Factor not in the list. Either way, the list was incomplete. Contradiction.
Worked Example. Prove: is irrational.
Solution
Suppose in lowest terms, with and . Then So is even, hence is even. Write . Then So Hence is even. But then both and are even, Contradicting .
3.4 Mathematical Induction
Principle of Mathematical Induction. To prove for all :
- Base case: Prove .
- Inductive step: Prove for all .
Strong Induction. The inductive step assumes to prove .
Example. Prove: for all .
Proof. Base case: : . True.
Inductive step: Assume . Then
Worked Example. Prove by strong induction: every integer can be factored into primes.
Solution
Base case: is prime, so it is a (trivial) product of primes.
Inductive step: Assume every integer in factors into primes, where . Consider .
If is prime, it is already a product of primes (itself).
If is composite, then where . By the strong induction Hypothesis, both and factor into primes. Hence also factors into primes.
Worked Example. Prove: for all .
Solution
Base case: : . ✓
Inductive step: Assume . Then
3.5 Structural Induction
For recursively defined structures (lists, trees, formulas), prove a property by induction on the Structure:
- Base cases (empty list, leaf node, atomic formula).
- Inductive cases (cons, node with children, compound formula).
3.6 The Well-Ordering Principle
Well-Ordering Principle (WOP). Every nonempty set of nonnegative integers has a least element.
Theorem 3.1. The Well-Ordering Principle is equivalent to the Principle of Mathematical Induction.
Proof (WOP implies induction). Let be a property with true and . Suppose for contradiction that fails for some . Let S = \\{n \geq 0 : P(n)\; \mathrm{is\; false{}\\}. By assumption So by WOP, has a least Element . Since is true, . Then is true (by minimality of ), And by the inductive hypothesis, so is true, contradicting . Therefore and holds for all .
Proof (induction implies WOP). Let be nonempty. We prove by induction that If Then has a least element. For , Contains Which is the least element. Assume the claim for . If Then is the least element. Otherwise And by The induction hypothesis applied to the shifted set, a least element exists.
Worked Example. Use the WOP to prove that every can be written as a sum of distinct Powers of 2.
Solution
Let be the set of positive integers that cannot be written as a sum of distinct powers of 2. Suppose . By WOP, has a least element .
Let be the largest power of 2 not exceeding (so ). Then and . If Then is a single power of 2, Contradicting . If Then So (by minimality Of ). Hence is a sum of distinct powers of 2, all of which are . Adding Gives as a sum of distinct powers of 2, contradicting . Therefore .
4. Combinatorics
4.1 Counting Principles
Rule of Sum. If task can be done in ways and task in ways, and they cannot both be Done, then or can be done in ways.
Rule of Product. If task can be done in ways and task in ways independently, then and together can be done in ways.
4.2 Permutations and Combinations
Permutations: — ordered arrangements of items from .
Combinations: — unordered selections of items from .
Theorem 4.1 (Binomial Theorem).
Theorem 4.2 (Pascal’s Identity).
Proof. Every -subset of either contains (giving ways To choose the remaining ) or does not contain (giving ways to choose all From ).
4.3 Inclusion-Exclusion Principle
Theorem 4.3 (Inclusion-Exclusion). For finite sets :
Proof (for two sets). Every element of is in or or both. Counting counts elements in twice, so we subtract once: .
For the general case, an element in exactly of the sets is counted time, which is correct.
Worked Example. How many integers from 1 to 1000 are not divisible by 2, 3, or 5?
Let = multiples of 2, = multiples of 3, = multiples of 5.
, , .
, , .
.
.
Not divisible by 2, 3, or 5: .
Worked Example. How many integers from 1 to 500 are divisible by 3 or 7 but not by 5?
Solution
Let = multiples of 3, = multiples of 7, = multiples of 5 in .
.
.
Divisible by 3 or 7: .
Divisible by 3 or 7 and by 5: .
Divisible by 3 or 7 but not by 5: .
4.4 Stars and Bars
Theorem 4.4. The number of ways to distribute identical objects into distinct bins is .
Proof. The problem is equivalent to placing dividers among objects, giving arrangements.
Worked Example. How many solutions does have with ?
Solution
Substitute . Then with . By stars and bars: .
Worked Example. How many solutions does have with ?
Solution
Directly by stars and bars: .
4.5 The Pigeonhole Principle
Theorem 4.5 (Pigeonhole Principle). If objects are placed into boxes and Then at Least one box contains at least objects.
Proof. If every box contained at most objects, the total would be at most Contradicting that there are objects.
Worked Example. In a class of 400 students, at least how many were born in the same month?
Solution
There are 12 months (boxes) and 400 students (objects). By the pigeonhole principle, some month Has at least students.
Worked Example. Show that among any integers from Two of them Differ by exactly .
Solution
Partition into pigeonholes: , , . Each pair sums to … Let me rephrase.
Partition into , , , . These are disjoint sets. If we select integers from By the pigeonhole principle two must lie in the Same set And their difference is .
Worked Example. Prove that any sequence of distinct real numbers contains a monotone (increasing or decreasing) subsequence of length .
Solution
Let be the sequence. For each Let be the length of the Longest increasing subsequence starting at And the length of the longest decreasing Subsequence starting at .
Suppose for contradiction that every monotone subsequence has length at most . Then and So there are at most distinct ordered pairs . Since we have elements, by the pigeonhole principle two indices Have .
If Then (append before the increasing subsequence starting At ), contradicting .
If Then Contradicting .
Either way we have a contradiction.
Theorem 4.6 (Generalised Pigeonhole Principle). If objects are placed into boxes, then at Least one box contains at least objects. Equivalently, if each box contains at most objects, then the total number of objects is at most .
Worked Example. A drawer contains red, blue, and yellow socks. How many socks must be drawn (without looking) to guarantee at least 4 socks of the same colour?
Solution
There are 3 colours (boxes). By the generalised pigeonhole principle, drawing socks guarantees At least of one colour. We need So Giving .
With 9 socks it is possible to have 3 of each colour (no colour reaches 4). With 10 socks, one Colour must have at least .
Worked Example. Prove that in any group of people, there are at least two who have shaken Hands with the same number of people (within the group).
Solution
Each person can shake hands with between 0 and others, giving possible values. But the Values 0 and cannot both occur (if someone shook no hands, no one shook everyone’s hand, And vice versa). So there are at most distinct handshake counts among people. By the Pigeonhole principle, at least two people have the same count.
4.6 Catalan Numbers
The -th Catalan number is
The first few values: , , , , , .
Catalan numbers count:
- The number of valid (properly matched) sequences of pairs of parentheses.
- The number of binary search trees with nodes.
- The number of ways to triangulate a convex -gon.
- The number of lattice paths from to that never go above the diagonal.
Recurrence. and for :
Worked Example. Verify by listing all valid sequences of 3 pairs of parentheses.
Solution
The five valid sequences are: , , , , .
Checking: . ✓
4.7 Generating Functions for Combinatorics
The ordinary generating function (OGF) of a sequence is
Common generating functions:
| Sequence | Generating function |
|---|---|
Key operations. If generates and generates :
- generates (choice between types).
- generates where (combining two choices).
Worked Example. Find the number of ways to select coins from unlimited supplies of 1p, 2p, And 5p coins.
Solution
The generating function is
G(x) = \underbrace{(1 + x + x^2 + \cdots)}_{\mathrm{1p\; coins{}} \cdot \underbrace{(1 + x^2 + x^4 + \cdots)}_{\mathrm{2p\; coins{}} \cdot \underbrace{(1 + x^5 + x^{10} + \cdots)}_{\mathrm{5p\; coins{}}
The coefficient of in the expansion gives the number of ways. For example, expanding the First few terms: So there are 4 ways to make 5p (5×1p; 3×1p + 1×2p; 1×1p + 2×2p; 1×5p).
5. Graph Theory
5.1 Definitions
A graph consists of a set of vertices and a set of edges .
- Simple graph: no loops, no multiple edges.
- Directed graph (digraph): edges have direction.
- Weighted graph: edges have weights.
The degree of a vertex , Is the number of edges incident to .
Theorem 5.1 (Handshaking Lemma). .
Proof. Each edge contributes 1 to the degree of each of its two endpoints.
Corollary 5.2. The number of vertices of odd degree is even.
5.2 Paths, Cycles, and Connectivity
A walk is a sequence of vertices where consecutive vertices are adjacent. A path is a walk With no repeated vertices. A cycle is a path that returns to its starting vertex.
A graph is connected if there is a path between every pair of vertices. A connected component Is a maximal connected subgraph.
Theorem 5.3. A graph with vertices and more than edges is connected.
5.3 Trees
A tree is a connected acyclic graph. A forest is a disjoint union of trees.
Theorem 5.4. For a graph with vertices, the following are equivalent:
- is a tree.
- is connected and has edges.
- is acyclic and has edges.
- Between any two vertices, there is exactly one path.
Cayley’s Formula. The number of labelled trees on vertices is .
5.4 Planarity
A graph is planar if it can be drawn in the plane with no edge crossings.
Theorem 5.5 (Euler’s Formula for Planar Graphs). For a connected planar graph drawn in the plane With vertices, edges, and faces:
Proof sketch. Build the graph edge by edge. Starting from a single vertex (, , ), The quantity is preserved when adding an edge: if the edge connects two components, and each increase by 1; if it splits a face, and each increase by 1.
Corollary 5.6. For a simple planar graph with : .
Proof. Every face has at least 3 edges on its boundary, and every edge borders at most 2 faces, So . By Euler’s formula, Giving I.e., .
Corollary 5.7. and are not planar.
Proof. has , But . For , , . Since has no triangles, every face has at least 4 edges, giving So . But gives . Contradiction.
Theorem 5.8 (Kuratowski’s Theorem). A graph is planar if and only if it does not contain a Subdivision of or as a subgraph.
A subdivision of an edge replaces with a path —— through a new vertex . A graph is a subdivision of if can be obtained from by subdividing edges.
Worked Example. Show that is not planar using Euler’s formula.
Solution
has vertices and edges. It is bipartite (partition sizes 3 and 3), so it Contains no triangles. Every face in a planar embedding must therefore be bounded by at least 4 edges, Giving I.e., .
But Euler’s formula gives . Since No planar embedding Exists.
5.5 Graph Colouring
A proper -colouring assigns one of colours to each vertex such that adjacent vertices have Different colours. The chromatic number is the minimum for which a proper -colouring Exists.
Theorem 5.9 (Four Colour Theorem). Every planar graph is 4-colourable.
Theorem 5.10 (Five Colour Theorem). Every planar graph is 5-colourable. (Easier to prove.)
Theorem 5.11 (Greedy Colouring Bound). where is the Maximum degree.
Theorem 5.12 (Brooks’ Theorem). If is connected and is neither a complete graph nor an odd Cycle, then .
Chromatic polynomial. The chromatic polynomial counts the number of proper -colourings of .
Theorem 5.13. is a polynomial in .
Deletion-contraction recurrence. For any edge of :
Where is with edge deleted, and is with contracted (its endpoints Merged).
Worked Example. Find the chromatic polynomial of (the 4-cycle).
Solution
Label the vertices of as with edges , , , .
Pick edge .
is a path on 4 vertices (a tree): .
merges and Yielding (triangle): .
Therefore .
Checking: (two 2-colourings: alternating), and .
Worked Example. Find and .
Solution
(complete graph on vertices): every pair of vertices is adjacent, so all vertices must Receive distinct colours. Hence .
(complete bipartite graph): no two vertices within the same partition are adjacent, so we Can colour all vertices in the first partition with colour 1 and all in the second with colour 2. Hence (for ).
Worked Example. Find the chromatic polynomial of (triangle).
Solution
Choose a colour for vertex 1: choices. Choose a colour for vertex 2 (different from vertex 1): choices. Choose a colour for vertex 3 (different from both): choices.
.
Checking: (not 2-colourable, as expected). .
5.6 Euler and Hamilton Paths
An Euler path visits every edge exactly once. An Euler circuit is an Euler path that starts And ends at the same vertex.
Theorem 5.14. A connected graph has an Euler circuit if and only if every vertex has even degree. It has an Euler path (but not circuit) if and only if exactly two vertices have odd degree.
Proof (sufficiency). If every vertex has even degree, start at any vertex and follow edges, never Reusing an edge. Since all degrees are even, the walk can only terminate at the starting vertex, Forming a circuit . If uses all edges, we are done. Otherwise, remove ‘s edges; each Remaining component has all vertices of even degree (each lost an even number of incident edges). By induction, each component has an Euler circuit. Splicing these circuits into at shared Vertices yields an Euler circuit of the full graph.
Worked Example. Does have an Euler circuit? An Euler path?
Solution
has 5 vertices. The two vertices in the first partition each have degree 3 (connected to All three in the second partition). The three vertices in the second partition each have degree 2.
Vertices of odd degree: two (each of degree 3). Since exactly two vertices have odd degree, has an Euler path (starting at one odd-degree vertex, ending at the other) but not an Euler circuit.
A Hamilton path visits every vertex exactly once. A Hamilton circuit is a Hamilton path that Returns to the start.
Theorem 5.15 (Dirac’s Theorem). If is a simple graph with vertices and for every vertex, then has a Hamilton circuit.
Theorem 5.16 (Ore’s Theorem). If is a simple graph with vertices and for every pair of non-adjacent vertices Then has a Hamilton Circuit.
Note that Dirac’s theorem is a corollary of Ore’s theorem.
Worked Example. Does have a Hamilton circuit?
Solution
has 5 vertices. A Hamilton circuit must visit all 5 vertices and return. Label the Partitions as and . Any cycle in a bipartite graph alternates Between the two partitions. A Hamilton cycle would alternate between and Requiring . But So no Hamilton circuit exists.
However, does have Hamilton paths (e.g., — wait, this doesn’t Alternate properly). Actually, in edges only exist between and . A path must alternate or . A Hamilton path visits all 5 vertices, so it has the Form (length 5, starting and ending in ) or (length 5, starting And ending in ). The first requires 3 vertices from But . The second requires 3 Vertices from And . So a Hamilton path exists: e.g., .
Worked Example. Let have vertices and edges . Does have an Euler circuit or Euler path?
Solution
Degrees: , , , , . Two vertices (1 and 5) have odd degree. Since exactly two vertices have odd degree, has an Euler Path (starting at 1, ending at 5) but no Euler circuit.
One Euler path: . All 7 edges are used exactly once. ✓
Algorithm (Hierholzer’s). To find an Euler circuit: start at any vertex, follow unused edges Until returning to the start. If unused edges remain, find a vertex on the current circuit with Unused edges, find a subtour, and splice it in. Repeat until all edges are used.
:::caution Common Pitfall Determining whether a graph has a Hamilton path/circuit is NP-complete , whereas Euler Paths/circuits can be determined in polynomial time using the degree condition. Do not confuse the two. :::
5.7 Matching Theory
A matching in a graph is a set of pairwise disjoint edges (no two share an Endpoint). A vertex is matched if it is an endpoint of an edge in ; otherwise it is unmatched. A perfect matching covers every vertex.
Theorem 5.17 (Hall’s Marriage Theorem, 1935). Let be a bipartite graph with Partitions and . There exists a matching that covers every vertex in if and only if for Every subset
Where N(S) = \\{y \in Y : \exists\, x \in S\; \mathrm{with{}\; xy \in E\\} is the neighbourhood of .
Proof (necessity). If a matching covers Each is matched to a distinct So .
Proof (sufficiency by induction on ). Base case : Hall’s condition gives So has a neighbour, and we can match to it.
Inductive step. Consider two cases.
Case 1: For every nonempty proper subset , . Pick any edge . In Hall’s condition still holds (removing one element from each side preserves the Strict inequality). By the induction hypothesis, can be matched in . Adding Gives the desired matching.
Case 2: There exists a nonempty proper with . Match to By the induction hypothesis. In For any So
Where the inequality uses Hall’s condition on in . By the induction hypothesis, can be matched in . Combining with the matching on gives the result.
Worked Example. Let and with edges —; —; —; —. Does a matching covering exist?
Solution
Check Hall’s condition for every subset :
- : each vertex has at least 1 neighbour. ✓
- : , . , . Similarly all pairs have . ✓
- : , . , . All triples have . ✓
- : , . ✓
Hall’s condition is satisfied, so a matching exists. One such matching: —, — —, —.
5.8 Network Flows
A flow network is a directed graph with a source A sink And a capacity function . A flow Satisfies:
- Capacity constraint: for all .
- Flow conservation: for all \sum_{e\; \mathrm{into{}\; v} f(e) = \sum_{e\; \mathrm{out\; of{}\; v} f(e).
The value of a flow is |f| = \sum_{e\; \mathrm{out\; of{}\; s} f(e) - \sum_{e\; \mathrm{into{}\; s} f(e).
An s-t cut partitions into (containing ) and (containing ). The capacity of the cut is .
Theorem 5.18 (Max-Flow Min-Cut Theorem). In any flow network, the maximum value of a flow from to equals the minimum capacity of an - cut.
Proof sketch. Let be a maximum flow. Define the residual graph with the same Vertices and residual capacity for forward edges and For backward edges. Let be the set of vertices reachable from in via edges with Positive residual capacity. Since is maximum, (otherwise we could augment the Flow). The cut has capacity exactly (all forward edges are saturated, All backward edges have zero flow). Therefore minimum cut Capacity Giving equality.
Theorem 5.19 (Integrality Theorem). If all capacities are integers, there exists a maximum flow Where every is an integer.
Corollary 5.20. If all capacities are integers, the maximum flow value is an integer.
The Ford—Fulkerson method repeatedly finds augmenting paths in the residual graph and pushes Flow along them. When capacities are integers, each augmentation increases the flow by at least 1, Guaranteeing termination.
6. Recurrence Relations
6.1 Definition
A recurrence relation defines a sequence by expressing in terms of previous terms.
Example. Fibonacci: With , .
6.2 Linear Homogeneous Recurrences with Constant Coefficients
Solution method. Form the characteristic equation:
Case 1 (distinct roots). If are distinct, then .
Case 2 (repeated roots). If has multiplicity The contribution is .
6.3 Worked Example
Problem. Solve with , .
Solution. Characteristic equation: Giving , .
.
From initial conditions:
Solving: , . So .
Worked Example. Solve with , .
Solution
Characteristic equation: So . Root with multiplicity 2.
.
From initial conditions:
So .
6.4 Generating Functions
The generating function of a sequence is
Example. The generating function for (all ones) is .
Example. The generating function for is .
Generating functions can solve recurrences by converting them to algebraic equations in Then extracting coefficients.
Worked Example. Use generating functions to solve the Fibonacci recurrence With , .
Solution
Let .
Factor: where and .
Partial fractions give So (Binet’s formula).
Worked Example. Use generating functions to solve with .
Solution
Let .
Partial fractions: .
. Setting : So . Setting : So , .
Giving .
:::caution Common Pitfall Generating functions are formal power series; they may not converge for any . Convergence Is irrelevant for combinatorial applications — the series is manipulated algebraically. :::
6.5 The Master Theorem
The Master Theorem provides asymptotic solutions to recurrences of the form
Where , are constants and is asymptotically positive. Define c_{\mathrm{crit{}} = \log_b a (the critical exponent).
Theorem 6.1 (Master Theorem). Let be defined as above.
Case 1: If for some c \lt c_{\mathrm{crit{}}Then T(n) = \Theta(n^{c_{\mathrm{crit{}}}).
Case 2: If f(n) = \Theta(n^{c_{\mathrm{crit{}}} \log^k n) for some Then T(n) = \Theta(n^{c_{\mathrm{crit{}}} \log^{k+1} n).
Case 3: If for some c \gt c_{\mathrm{crit{}}And For some and sufficiently large (the regularity condition), then .
Worked Example. Solve .
Solution
, , . Critical exponent: c_{\mathrm{crit{}} = \log_2 3 \approx 1.585.
Since for any And 2 \gt 1.585 = c_{\mathrm{crit{}}We are in Case 3 (provided the regularity condition holds). Check: For . ✓
Therefore .
Worked Example. Solve .
Solution
, , . Critical exponent: c_{\mathrm{crit{}} = \log_2 2 = 1.
So we are in Case 2 with .
Therefore .
Worked Example. Solve .
Solution
, , . Critical exponent: c_{\mathrm{crit{}} = \log_2 4 = 2.
for any with So we are in Case 1.
Therefore .
Proof sketch of the Master Theorem. Expand the recurrence tree. At level (root is level 0), There are subproblems, each of size Each contributing work. The tree has levels, with a^{\log_b n} = n^{c_{\mathrm{crit{}}} leaves. The total work is
T(n) = \Theta\!\left(n^{c_{\mathrm{crit}}\right) + \sum_{j=0}^{\log_b n - 1} a^j \, f(n/b^j)}
- Case 1: with c \lt c_{\mathrm{crit{}}. The sum is dominated by the leaves, giving T(n) = \Theta(n^{c_{\mathrm{crit{}}}).
- Case 2: f(n) = \Theta(n^{c_{\mathrm{crit{}}} \log^k n). Each level contributes the same order, with levels, giving T(n) = \Theta(n^{c_{\mathrm{crit{}}} \log^{k+1} n).
- Case 3: with c \gt c_{\mathrm{crit{}}. The root level dominates, giving . The regularity condition ensures the root dominates all levels below. The Master Theorem does not apply to recurrences like (not of the form ). Also, if falls between cases (e.g., with c_{\mathrm{crit{}} = 1), the Master Theorem does not apply and the Akra—Bazzi method should be used Instead.
7. Problem Set
Problem 1. Prove that is a tautology using a truth table.
Solution
| disjunction | ||||
|---|---|---|---|---|
| T | T | T | T | T |
| T | F | F | T | T |
| F | T | T | F | T |
| F | F | T | T | T |
All rows give So it is a tautology.
If you get this wrong, revise: Section 1.1 and Section 1.4.
Problem 2. Convert to DNF.
Solution
The formula is a conjunction of two clauses. Distribute over :
.
This is in DNF (disjunction of four terms, each a conjunction of two literals).
If you get this wrong, revise: Section 1.6.
Problem 3. Negate: “For every real number There exists a real number such that .”
Solution
Original: .
Negation: I.e., “there exists a real number such that every Real number satisfies .”
If you get this wrong, revise: Section 1.2.
Problem 4. Prove that if and only if .
Solution
() Assume . Let . Then and . But implies Contradiction. So .
() Assume . Let . If Then So Contradiction. Hence Proving .
If you get this wrong, revise: Section 2.1.
Problem 5. Show that the relation on defined by iff is even Is an equivalence relation. How many equivalence classes are there?
Solution
Reflexive: Which is even. ✓ Symmetric: If is even, then is even. ✓ Transitive: If and are even, then is even. ✓
The equivalence classes are [0] = \\{\mathrm{even\; integers{}\\} and [1] = \\{\mathrm{odd\; integers{}\\}. There are exactly 2 equivalence classes.
If you get this wrong, revise: Section 2.2.
Problem 6. Let be and Be . Find and . Is injective?
Solution
.
.
Note So composition is not commutative.
is not injective: and But .
If you get this wrong, revise: Section 2.3.
Problem 7. Prove that the set of all infinite binary sequences is uncountable.
Solution
Suppose the set of all infinite binary sequences is countable, so Where with each .
Define by (flip the -th bit of the -th Sequence). Then but for every (they differ in position ). This Contradicts . Therefore is uncountable.
If you get this wrong, revise: Section 2.4.
Problem 8. Prove: the product of any two odd integers is odd.
Solution
Let and be odd. Then Which is odd.
If you get this wrong, revise: Section 3.1.
Problem 9. Prove: if is odd, then is odd.
Solution
By contrapositive: assume is even, so . Then Which is Even.
If you get this wrong, revise: Section 3.2.
Problem 10. Prove: is irrational.
Solution
Suppose in lowest terms. Then So Hence . Write . Then So Giving and . But then Contradicting lowest terms.
If you get this wrong, revise: Section 3.3.
Problem 11. Prove by induction: for all .
Solution
Base case: : . ✓
Inductive step: Assume . Then
If you get this wrong, revise: Section 3.4.
Problem 12. Prove by strong induction that every integer is a product of primes.
Solution
Base case: is prime, hence a product of primes.
Inductive step: Assume every integer in is a product of primes (). If is prime, done. If is composite, then where . By the induction hypothesis, both and are products of primes, so is too.
If you get this wrong, revise: Section 3.4 (strong induction).
Problem 13. A committee of 5 is to be chosen from 12 people. How many ways if two specific People must either both serve or neither serves?
Solution
Case 1: Both serve. Choose the remaining 3 from the other 10: . Case 2: Neither serves. Choose all 5 from the other 10: .
Total: .
If you get this wrong, revise: Section 4.2.
Problem 14. How many integers from 1 to 500 are divisible by 3 or 7 but not by 5?
Solution
, , . Divisible by 3 or 7: .
, , . Divisible by 3 or 7 and 5: .
Divisible by 3 or 7 but not 5: .
If you get this wrong, revise: Section 4.3.
Problem 15. How many solutions does have with ?
Solution
Substitute : with . By stars and bars: .
If you get this wrong, revise: Section 4.4.
Problem 16. Prove that among any 13 people, at least 2 were born in the same month.
Solution
There are 12 months and 13 people. By the pigeonhole principle, at least one month contains at least people.
If you get this wrong, revise: Section 4.5.
Problem 17. Verify that using the Catalan recurrence and the closed form.
Solution
By recurrence: .
By closed form: . ✓
If you get this wrong, revise: Section 4.6.
Problem 18. Find the chromatic number of (the 5-cycle) and justify.
Solution
is an odd cycle. It cannot be 2-coloured (an odd cycle requires 3 colours: colour the first Vertex 1, alternate 2 and 1 around, and the last vertex (5th) is adjacent to both the 4th (colour 2) And the 1st (colour 1), so it needs colour 3).
A 3-colouring exists: label vertices ; colour , , , .
Therefore .
If you get this wrong, revise: Section 5.5.
Problem 19. In the bipartite graph with partitions and And edges —; —; —Verify Hall’s condition and find a matching covering .
Solution
Neighbourhoods: , , . , , . .
All satisfy . A matching: —, —, —.
If you get this wrong, revise: Section 5.7.
Problem 20. Solve with , .
Solution
Characteristic equation: Giving So , .
.
. .
So , Giving .
If you get this wrong, revise: Section 6.2 and Section 6.3.
Common Pitfalls
Dropping negative signs during algebraic manipulation — substitute back to verify your answer.
Confusing the converse with the contrapositive — only the contrapositive is logically equivalent to the original implication.
Worked Examples
Example 1: Proof by Mathematical Induction
Problem. Prove that for all .
Solution. Base case (): LHS = 1, RHS = . ✓
Inductive step: assume true for . For :
Which matches the formula with replaced by . ✓
Example 2: Graph Colouring
Problem. Find the chromatic number of the complete bipartite graph and a cycle .
Solution. : bipartite graphs are 2-colourable. Assign colour 1 to the part of size 3 and colour 2 to the part of size 4. .
: odd cycle. Try 2 colours: impossible because odd length forces the first and last vertex to conflict. With 3 colours: colour vertices cyclically 1, 2, 3, 1, 2. .
Summary
- Logic: propositions, predicates, quantifiers (, ); truth tables and inference rules (modus ponens, resolution).
- Set theory: unions, intersections, complements, power sets; cardinality of finite and infinite sets (Cantor’s diagonal argument).
- Combinatorics: counting principles, permutations (), combinations (), inclusion-exclusion.
- Graph theory: Euler/Hamilton paths, planarity (Euler’s formula ), graph colouring, trees.
- Proof techniques: direct, contrapositive, contradiction, induction (weak and strong); structural induction for recursively defined objects.
Cross-References
| Topic | Site | Link |
|---|---|---|
| Theory of Computation | WyattsNotes | View |
| Abstract Algebra | WyattsNotes | View |
| Number Theory | WyattsNotes | View |
| Discrete Mathematics — MIT 6.042J | MIT OCW | View |