Docsity

Discrete Mathematics for Computing: Sets, Logic, Proofs, Relations, Counting and Graphs, Study Guides, Projects, Research of Discrete Mathematics

Toggle sidebar
bg1
Discrete Mathematics for Computing:
Sets, Logic, Proofs, Relations,
Functions, Combinatorics and Graphs
A study guide with truth tables, worked proofs, counting problems, graph algorithm traces, a
summary table and practice questions
Author: Psychedelic Tunes
How to use this guide. Discrete mathematics is the mathematics of separate, countable objects, the
kind computers handle. Logic underlies circuits and program conditions; sets and relations underlie
databases; functions and counting underlie hashing, algorithm analysis and probability; graphs and trees
model networks, dependencies and data structures. Each section gives the definitions, then worked
examples in the style of exam questions. Every truth table, set result, count and graph trace was
checked with a Python script written for this guide.
Notation used. ∈ "is an element of", ⊆ "is a subset of", ∪ union, ∩ intersection, A' complement, ∅
empty set, |A| number of elements, ¬ not, ∧ and, ∨ or, → implies, ↔ if and only if, ∀ for all, ∃ there exists,
ℤ integers, ℕ natural numbers, ℝ real numbers.
Contents
Sets
Propositional logic and truth tables
Predicate logic and quantifiers
Methods of proof, including induction
Relations
Functions
Combinatorics (counting)
Graphs
Trees
Summary table
Practice questions and answers
1. Sets
A set is an unordered collection of distinct objects. Order and repetition do not matter: {1, 2, 3} = {3, 1,
2, 2}. A set can be given by listing (roster form), {2, 4, 6, 8}, or by a rule (set-builder form), {x ∈ ℤ | x is
even and 0 < x < 10}.
A ⊆ B if every element of A is in B; A ⊂ B (proper subset) if also A ≠ B. ∅ is a subset of every set.
The power set P(A) is the set of all subsets of A. If |A| = n then |P(A)| = 2ⁿ. For A = {a, b, c}: P(A)
= {∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}, 8 subsets.
The Cartesian product A × B = {(a, b) | a ∈ A, b ∈ B} is a set of ordered pairs, and |A × B| = |A|
× |B|. {1, 2} × {x, y, z} = {(1, x), (1, y), (1, z), (2, x), (2, y), (2, z)}.
1.1 Set operations: a worked example
Let the universal set be U = {1, 2, …, 10}, A = {1, 2, 3, 4, 5, 6}, B = {4, 5, 6, 7, 8} and C = {2, 4, 6, 8,
10}.
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
•
•
•
Psychedelic Tunes Page 1 of 13
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download Discrete Mathematics for Computing: Sets, Logic, Proofs, Relations, Counting and Graphs and more Study Guides, Projects, Research Discrete Mathematics in PDF only on Docsity!

Discrete Mathematics for Computing:

Sets, Logic, Proofs, Relations,

Functions, Combinatorics and Graphs

A study guide with truth tables, worked proofs, counting problems, graph algorithm traces, a

summary table and practice questions

Author: Psychedelic Tunes

How to use this guide. Discrete mathematics is the mathematics of separate, countable objects, the kind computers handle. Logic underlies circuits and program conditions; sets and relations underlie databases; functions and counting underlie hashing, algorithm analysis and probability; graphs and trees model networks, dependencies and data structures. Each section gives the definitions, then worked examples in the style of exam questions. Every truth table, set result, count and graph trace was checked with a Python script written for this guide.

Notation used. ∈ "is an element of", ⊆ "is a subset of", ∪ union, ∩ intersection, A' complement, ∅ empty set, |A| number of elements, ¬ not, ∧ and, ∨ or, → implies, ↔ if and only if, ∀ for all, ∃ there exists, ℤ integers, ℕ natural numbers, ℝ real numbers.

Contents

Sets Propositional logic and truth tables Predicate logic and quantifiers Methods of proof, including induction Relations Functions Combinatorics (counting) Graphs Trees Summary table Practice questions and answers

1. Sets

A set is an unordered collection of distinct objects. Order and repetition do not matter: {1, 2, 3} = {3, 1, 2, 2}. A set can be given by listing (roster form), {2, 4, 6, 8}, or by a rule (set-builder form), {x ∈ ℤ | x is even and 0 < x < 10}.

A ⊆ B if every element of A is in B; A ⊂ B (proper subset) if also A ≠ B. ∅ is a subset of every set. The power set P(A) is the set of all subsets of A. If |A| = n then |P(A)| = 2ⁿ. For A = {a, b, c}: P(A) = {∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}, 8 subsets. The Cartesian product A × B = {(a, b) | a ∈ A, b ∈ B} is a set of ordered pairs, and |A × B| = |A| × |B|. {1, 2} × {x, y, z} = {(1, x), (1, y), (1, z), (2, x), (2, y), (2, z)}.

1.1 Set operations: a worked example

Let the universal set be U = {1, 2, …, 10}, A = {1, 2, 3, 4, 5, 6}, B = {4, 5, 6, 7, 8} and C = {2, 4, 6, 8, 10}.

Operation Definition Result A ∪ B In A or B (or both) {1, 2, 3, 4, 5, 6, 7, 8} A ∩ B In both A and B {4, 5, 6} A − B In A but not in B {1, 2, 3} B − A In B but not in A {7, 8} A' In U but not in A {7, 8, 9, 10} A ⊕ B (symmetric difference) In exactly one of A, B {1, 2, 3, 7, 8} A ∩ B ∩ C In all three {4, 6} (A ∪ B) ∩ C In A or B, and also in C {2, 4, 6, 8} (A ∪ B)' Neither in A nor in B {9, 10}

De Morgan's laws for sets: (A ∪ B)' = A' ∩ B' and (A ∩ B)' = A' ∪ B'. Check: A' ∩ B' = {7, 8, 9, 10} ∩ {1, 2, 3, 9, 10} = {9, 10} = (A ∪ B)'. Other laws mirror the logic laws in section 2: commutative, associative, distributive (A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)), identity (A ∪ ∅ = A), complement (A ∪ A' = U) and absorption (A ∪ (A ∩ B) = A).

1.2 The inclusion–exclusion principle

Two sets: |A ∪ B| = |A| + |B| − |A ∩ B|. Three sets: |A ∪ B ∪ C| = |A| + |B| + |C| − |A ∩ B| − |A ∩ C| − |B ∩ C| + |A ∩ B ∩ C|.

Worked example 1. How many integers from 1 to 300 are divisible by 3, 5 or 7? Let the sets be multiples of each. |A₃| = ⌊300/3⌋ = 100, |A₅| = 60, |A₇| = 42; pairwise intersections are multiples of the products: |A₁₅| = 20, |A₂₁| = 14, |A₃₅| = 8; and |A₁₀₅| = 2. Total = 100 + 60 + 42 − 20 − 14 − 8 + 2 = 162 , so 300 − 162 = 138 are divisible by none of them.

Worked example 2. In a class of 120 students, 70 study Python, 55 Java and 40 C; 25 study Python and Java, 20 Python and C, 15 Java and C, and 10 study all three. Students taking at least one = 70 + 55 + 40 − 25 − 20 − 15 + 10 = 115 , so 5 take none. Students taking only Python = 70 − 25 − 20 + 10 = 35 (subtract both overlaps, then add back the triple overlap that was subtracted twice). A three-circle Venn diagram filled from the centre outward gives the same numbers.

2. Propositional logic and truth tables

A proposition is a statement that is either true (T) or false (F), but not both: "7 is prime" (T), "Nairobi is in Uganda" (F). "Close the door" and "x + 1 = 5" are not propositions (the first is a command, the second depends on x).

2.1 Connectives

p q ¬p p ∧ q p ∨ q p ⊕ q p → q p ↔ q T T F T T F T T T F F F T T F F F T T F T T T F F F T F F F T T

The conditional p → q ("if p then q") is false only when p is true and q is false. When p is false the conditional is vacuously true : the promise "if it rains, I will carry an umbrella" is not broken on a dry day. p is the hypothesis and q the conclusion ; p → q can also be read "p is sufficient for q", "q is necessary for p" and "p only if q".

Rule Premises Conclusion Modus ponens p → q, p q Modus tollens p → q, ¬q ¬p Hypothetical syllogism p → q, q → r p → r Disjunctive syllogism p ∨ q, ¬p q Simplification / conjunction p ∧ q / p, q p / p ∧ q Resolution p ∨ q, ¬p ∨ r q ∨ r

Two common fallacies : affirming the conclusion (p → q, q, therefore p) and denying the hypothesis (p → q, ¬p, therefore ¬q). Both are invalid: check the row p = F, q = T.

3. Predicate logic and quantifiers

A predicate P(x) is a statement with a variable, which becomes a proposition once x is given a value from its domain. With domain ℤ and P(x): "x > 3", P(5) is true and P(1) is false.

Universal quantifier: ∀x P(x) means "P(x) is true for every x in the domain". One counterexample shows it is false. Existential quantifier: ∃x P(x) means "there is at least one x for which P(x) is true". One example shows it is true.

Negation rules: ¬∀x P(x) ≡ ∃x ¬P(x) and ¬∃x P(x) ≡ ∀x ¬P(x). Push the negation inward, flipping each quantifier.

Worked example. "Every student passed some test": ∀s ∃t Passed(s, t). Negation: ∃s ∀t ¬Passed(s, t): "some student failed every test".

Order matters with mixed quantifiers. Over the integers, ∀x ∃y (x + y = 0) is true (for each x choose y = −x), but ∃y ∀x (x + y = 0) is false (no single y works for every x).

4. Methods of proof

Method To prove p → q you… Good when… Direct proof Assume p and deduce q step by step The hypothesis gives you something concrete to work with Contrapositive Assume ¬q and deduce ¬p The negated conclusion is easier to use Contradiction Assume p and ¬q, and derive something impossible

Proving that something does not exist, or irrationality Cases Split into exhaustive cases and prove each

Even/odd, positive/negative, etc.

Counterexample (To disprove a ∀ statement) give one case where it fails

The claim is false

Mathematical induction

Prove a base case and P(k) → P(k + 1) Statements about all n ≥ some n₀

Definitions used below: n is even if n = 2k and odd if n = 2k + 1 for some integer k. A number is rational if it equals a/b with integers a, b and b ≠ 0.

Direct proof. If m and n are odd, then m + n is even. Let m = 2a + 1 and n = 2b + 1. Then m + n = 2a

  • 2b + 2 = 2(a + b + 1), which is 2 times an integer, so m + n is even. ∎

Proof by contrapositive. If n² is even, then n is even. The contrapositive is: if n is odd, then n² is odd. Let n = 2k + 1. Then n² = 4k² + 4k + 1 = 2(2k² + 2k) + 1, which is odd. Since the contrapositive is true, so is the original. ∎

Proof by contradiction. √2 is irrational. Suppose instead that √2 = a/b in lowest terms (a and b share no common factor). Then 2 = a²/b², so a² = 2b², which means a² is even, so a is even (previous proof). Write a = 2c: then 4c² = 2b², so b² = 2c², and b is even too. Now a and b are both even, contradicting "lowest terms". So √2 is irrational. ∎

Counterexample. "n² + n + 41 is prime for every natural number n." It holds for n = 0 to 39, but at n = 40 we get 40² + 40 + 41 = 1681 = 41², not prime. One counterexample is enough to disprove a universal claim; many examples are never enough to prove one.

4.1 Mathematical induction

To prove P(n) for all n ≥ n₀:

Base case: show P(n₀) is true. Inductive step: assume P(k) is true for an arbitrary k ≥ n₀ (the inductive hypothesis ) and use it to prove P(k + 1).

Worked example 1. Prove 1 + 2 + … + n = n(n + 1)/2 for all n ≥ 1.

Base: n = 1, left side = 1 and right side = 1 × 2/2 = 1. ✓ Step: assume 1 + … + k = k(k + 1)/2. Then 1 + … + k + (k + 1) = k(k + 1)/2 + (k + 1) = (k + 1) (k/2 + 1) = (k + 1)(k + 2)/2, which is the formula with n = k + 1. ∎

Worked example 2 (divisibility). Prove 6 divides 7ⁿ − 1 for all n ≥ 0.

Base: n = 0, 7⁰ − 1 = 0, which is divisible by 6. ✓ Step: assume 7ᵏ − 1 = 6m. Then 7ᵏ⁺¹ − 1 = 7 × 7ᵏ − 1 = 7(6m + 1) − 1 = 42m + 6 = 6(7m + 1). ∎

Worked example 3 (inequality). Prove 2ⁿ > n² for all n ≥ 5. (It fails for n = 2, 3 and 4, so the base case matters: 2⁴ = 16 = 4².)

Base: n = 5, 32 > 25. ✓ Step: assume 2ᵏ > k² with k ≥ 5. Then 2ᵏ⁺¹ = 2 × 2ᵏ > 2k² = k² + k² ≥ k² + 5k > k² + 2k + 1 = (k

  • 1)², using k² ≥ 5k (since k ≥ 5) and 5k > 2k + 1. ∎

Strong induction assumes P(n₀), …, P(k) are all true in order to prove P(k + 1). It is used, for example, to prove that every integer n ≥ 2 is a product of primes. Structural induction works the same way on recursively defined structures such as lists and trees.

5. Relations

A (binary) relation R from A to B is any subset of A × B; we write a R b when (a, b) ∈ R. A relation on A is a subset of A × A. A set with n elements has 2^(n²) possible relations on it (16 ordered pairs give 2¹⁶ = 65,536 relations when n = 4).

Representations. A relation on a finite set can be shown as a list of pairs, as a 0–1 matrix (Mᵢⱼ = 1 if aᵢ R aⱼ) or as a directed graph (an arrow from a to b for each pair, a loop for (a, a)).

5.1 Properties

Property Definition (for all a, b, c in A) Test on the matrix Reflexive (a, a) ∈ R All 1s on the main diagonal Irreflexive (a, a) ∉ R All 0s on the diagonal Symmetric (a, b) ∈ R → (b, a) ∈ R Matrix equals its transpose Antisymmetric (a, b) ∈ R and (b, a) ∈ R → a = b No pair of 1s mirrored across the diagonal Transitive (a, b) ∈ R and (b, c) ∈ R → (a, c) ∈ R Wherever there is a 2-step path there is a direct pair

Worked example on A = {1, 2, 3, 4}:

Pigeonhole principle. If n items go into k boxes and n > k, some box holds at least two items. Generalised: some box holds at least ⌈n/k⌉ items. Among 100 people at least ⌈100/12⌉ = 9 share a birth month. With socks of 3 colours, taking 4 guarantees a matching pair.

7. Combinatorics (counting)

Rule Use when… Formula Sum rule The task is done one way or another (disjoint choices)

m + n

Product rule The task is a sequence of steps, step 1 and step 2

m × n

Permutations Ordered selection of r from n, no repetition P(n, r) = n!/(n − r)! Combinations Unordered selection of r from n, no repetition C(n, r) = n!/(r!(n − r)!) Repetition allowed, ordered r positions, n choices each nʳ Repetition allowed, unordered (stars and bars)

Choose r items from n types C(n + r − 1, r)

Permutations with identical items n items with groups of n₁, n₂, … alike n!/(n₁! n₂! …) Circular arrangements n people round a table (n − 1)!

Worked examples.

Passwords: 6 characters, each a lowercase letter or digit: 36⁶ = 2,176,782,336. If the first must be a letter: 26 × 36⁵ = 1,572,120,. Ordered vs unordered: choosing a chair, secretary and treasurer from 10 people is P(10, 3) = 10 × 9 × 8 = 720 ; choosing an unranked 3-person committee is C(10, 3) = 720/3! = 120. Poker hands: C(52, 5) = 2,598,. Committee with conditions: 3 men from 7 and 2 women from 5: C(7, 3) × C(5, 2) = 35 × 10 = 350. A 5-person committee from these 12 people with at least one woman: all committees minus all-male ones = C(12, 5) − C(7, 5) = 792 − 21 = 771. ("At least one" problems are usually easiest by complement.) Identical letters: arrangements of BANANA = 6!/(3! 2!) = 60 ; MISSISSIPPI = 11!/(4! 4! 2!) = 34,. Stars and bars: non-negative integer solutions of x₁ + x₂ + x₃ = 10: C(12, 2) = 66. With every xᵢ ≥ 1, first give each variable 1, leaving 7 to share: C(9, 2) = 36. Choosing 6 doughnuts from 4 flavours: C(9, 3) = 84. Round table: 6 people: 5! = 120. If two particular people must sit together, treat them as one unit (5 units round the table → 4!) and multiply by their 2 internal orders: 2 × 4! = 48. Bit strings: length 8 with exactly three 1s: C(8, 3) = 56 ; with at least one 1: 2⁸ − 1 = 255. Derangements (nobody gets their own item back): D₄ = 4!(1 − 1 + 1/2 − 1/6 + 1/24) = 9.

The binomial theorem. (x + y)ⁿ = Σ C(n, k) xⁿ⁻ᵏ yᵏ for k = 0 to n. The coefficients form Pascal's triangle , built with C(n, k) = C(n − 1, k − 1) + C(n − 1, k): for n = 5 they are 1, 5, 10, 10, 5, 1. Worked example: the coefficient of x³y⁴ in (2x − y)⁷ comes from the term with k = 4: C(7, 4) × 2³ × (−1)⁴ = 35 × 8 = 280. Setting x = y = 1 gives Σ C(n, k) = 2ⁿ, the number of subsets of an n-set.

8. Graphs

A graph G = (V, E) is a set of vertices V and a set of edges E joining pairs of vertices. In a simple graph there are no loops and no repeated edges; a multigraph allows repeated edges; in a directed graph (digraph) each edge has a direction; a weighted graph has a number (cost, distance) on each edge.

Running example. An undirected weighted graph with vertices A–F and the 9 edges A–B 4, A–C 2, B–C 1, B–D 5, C–D 8, C–E 10, D–E 2, D–F 6 and E–F 3.

A ----4---- B ----5---- D ----6---- F

\ | / | /

\ | / | /

------- C ---/ E ---/

_____10_____/

(The bottom curve is the edge C–E with weight 10.)

Degree is the number of edges at a vertex. Here deg(A) = 2, deg(B) = 3, deg(C) = 4, deg(D) = 4, deg(E) = 3 and deg(F) = 2.

Handshaking lemma: the sum of all degrees = 2|E|, because each edge adds 1 to the degree of both its ends. Here 2 + 3 + 4 + 4 + 3 + 2 = 18 = 2 × 9. A consequence: every graph has an even number of odd-degree vertices (here B and E).

8.1 Terminology and special graphs

Term Meaning Walk / path / cycle A walk is any sequence of adjacent vertices; a path repeats no vertex; a cycle is a closed path Connected There is a path between every pair of vertices Complete graph Kₙ Every pair of vertices joined; n(n − 1)/2 edges (K₅ has 10, K₆ has 15) Bipartite graph Vertices split into two sets with every edge going between them; a graph is bipartite exactly when it has no odd-length cycle. K₃,₃ has 9 edges Subgraph / spanning subgraph

Part of a graph / one that keeps every vertex

Isomorphic graphs The same structure with different labels: same number of vertices, edges and degree sequence are necessary (but not sufficient) Planar graph Can be drawn with no crossing edges. Euler's formula for a connected planar graph: V − E + F = 2 (a planar graph with 8 vertices and 12 edges has 6 faces, counting the outer face). K₅ and K₃,₃ are not planar

8.2 Representations

Representation Space Check if edge (u, v)exists Best for

Adjacency matrix (n × n, 1 or the weight where an edge exists)

O(V²) O(1) Dense graphs

Adjacency list (each vertex lists its neighbours) O(V + E)

O(degree) Sparse graphs (most real networks)

Adjacency list for the running example: A: B, C · B: A, C, D · C: A, B, D, E · D: B, C, E, F · E: C, D, F · F: D, E.

8.3 Euler and Hamilton paths

An Euler circuit uses every edge exactly once and returns to the start. A connected graph has one if and only if every vertex has even degree. An Euler path (not closed) exists if and only if exactly two vertices have odd degree ; it must start at one and end at the other. The running example has exactly two odd vertices, B and E, so it has an Euler path from B to E but no Euler circuit. One such path: B–A–C–B–D–C–E–D–F–E. A Hamilton path/cycle visits every vertex exactly once. There is no simple test (deciding whether one exists is NP-complete), so you search for one. In the running example A–B–D–F–E–C–A works, because A–B, B–D, D–F, F–E, E–C and C–A are all edges, so the graph has a Hamilton cycle.

/ \

/ \ / \

Preorder (root, left, right): 50, 30, 20, 40, 35, 70, 60, 80 Inorder (left, root, right): 20, 30, 35, 40, 50, 60, 70, 80 (always sorted for a BST) Postorder (left, right, root): 20, 35, 40, 30, 60, 80, 70, 50 Height = 3 (the path 50–30–40–35).

Expression trees store operators in internal vertices and operands in leaves. For (3 + 4) × (5 − 2) the root is ×; preorder gives the prefix (Polish) form × + 3 4 − 5 2, and postorder gives the postfix form 3 4

  • 5 2 − ×, which a stack evaluates to 7 × 3 = 21.

9.1 Minimum spanning trees

A spanning tree of a connected graph uses all its vertices and is a tree (so it has V − 1 edges). A minimum spanning tree (MST) has the least total weight. MSTs are used to design cheap cable, road and pipe networks.

Kruskal's algorithm: sort all edges by weight; add each edge in turn unless it would create a cycle; stop at V − 1 edges. On the running example:

Edge (weight)

B–C

A–C

D–E

E–F

(3) A–B (4)^

B–D

(5) D–F (6), C–D (8), C–E (10)

Decision Take Take Take Take Skip (cycle A–B– C)

Take Not needed (5 edges chosen)

MST = {B–C, A–C, D–E, E–F, B–D}, total weight 1 + 2 + 2 + 3 + 5 = 13.

Prim's algorithm: start from any vertex and repeatedly add the cheapest edge joining the tree to a new vertex. From A: A–C (2), C–B (1), B–D (5), D–E (2), E–F (3). It gives the same tree and the same weight, 13. Kruskal suits sparse graphs given as an edge list; Prim suits dense graphs given as a matrix. (An MST minimises the total weight; it is not the same as the shortest-path tree from Dijkstra, although here they happen to coincide.)

10. Summary table

Topic Key facts Sets |P(A)| = 2ⁿ; |A × B| = |A||B|; De Morgan (A ∪ B)' = A' ∩ B' Inclusion–exclusion |A ∪ B ∪ C| = Σ singles − Σ pairs + triple Conditional p → q false only when p = T and q = F; ≡ ¬p ∨ q ≡ ¬q → ¬p Converse / inverse q → p and ¬p → ¬q are equivalent to each other, not to p → q Inference Modus ponens, modus tollens, hypothetical and disjunctive syllogism Quantifiers ¬∀x P ≡ ∃x ¬P; ¬∃x P ≡ ∀x ¬P; the order of mixed quantifiers matters Proofs Direct, contrapositive, contradiction, cases, counterexample Induction Base case + (P(k) → P(k + 1)); strong induction assumes all earlier cases Relation properties Reflexive, symmetric, antisymmetric, transitive Equivalence relation Reflexive + symmetric + transitive → partition into classes Partial order Reflexive + antisymmetric + transitive → Hasse diagram Functions Injective, surjective, bijective (invertible); (f ∘ g)(x) = f(g(x)) Pigeonhole Some box has at least ⌈n/k⌉ items Counting P(n, r) = n!/(n − r)!; C(n, r) = n!/(r!(n − r)!); nʳ; C(n + r − 1, r) Binomial theorem (x + y)ⁿ = Σ C(n, k) xⁿ⁻ᵏ yᵏ; Pascal C(n, k) = C(n − 1, k − 1) + C(n − 1, k) Handshaking Σ deg = 2|E|; the number of odd-degree vertices is even Euler Circuit iff all degrees even; path iff exactly 2 odd vertices Planar graphs V − E + F = 2; K₅ and K₃,₃ are not planar BFS / DFS Queue, level by level / stack, deep first Dijkstra Non-negative weights; finalise the smallest tentative distance, relax its edges Trees n − 1 edges; unique paths; full m-ary: n = mi + 1 MST Kruskal (sorted edges, avoid cycles) or Prim (grow from a vertex)

11. Practice questions

U = {1, …, 10}, A = {1, 3, 5, 7, 9} and B = {3, 6, 9}. Find A ∪ B, A ∩ B, A − B, B' and |P(B)|. How many integers from 1 to 1000 are divisible by 4 or 6? Build the truth table of (p → q) ∧ (q → p). Which single connective is it equivalent to? Use known equivalences to show that ¬(p → q) ≡ p ∧ ¬q. Write the negation of ∀x ∃y (x + y = 0) and decide which of the two statements is true over the integers. For "If n is even, then n² is even", write the converse, inverse and contrapositive. Which are true? "If I study, I pass. I did not pass. Therefore I did not study." Name the rule and say whether the argument is valid. What about "If I study, I pass. I passed. Therefore I studied"? Prove directly that the product of two odd integers is odd. Prove by induction that 1 + 2 + 4 + … + 2ⁿ = 2ⁿ⁺¹ − 1 for all n ≥ 0. Prove by induction that 1² + 2² + … + n² = n(n + 1)(2n + 1)/6. On {1, 2, 3}, R = {(1, 1), (2, 2), (3, 3), (1, 2), (2, 1)}. Which properties does R have? If it is an equivalence relation, give its classes. How many relations are there on a set of 4 elements? How many of them are reflexive? Is f: ℝ → ℝ, f(x) = 3x − 5 a bijection? If so, find f⁻¹. Is g(x) = x² (ℝ → ℝ) injective? How many functions are there from a 4-element set to a 2-element set, and how many of them are onto? In how many ways can a committee of 4 be chosen from 10 people? In how many ways can a president, vice-president and secretary be chosen from 8 people? How many distinct arrangements are there of the letters of LETTER? Find the coefficient of x⁵y³ in (3x − 2y)⁸. What is the least number of students that guarantees at least 3 share a birth month?

This guide is an original study aid written for revision. All sets, relations, graphs and counting problems were invented for it, and every result was checked with the script written for this guide.