A connected graph has 15 vertices and 16 edges. How many edges k must be removed to leave a spanning tree?
|V| = 15|E| = 16
k =
6.Graph theoryHard
Prim’s algorithm builds a minimum spanning tree starting from vertex A. Click the edge it adds as edge number 3.
start: Ak = 3
1edge AB
2edge AC
3edge BC
4edge BD
5edge CE
6edge DE
7edge BE
7.Number theory & modular arithmeticMedium
Find the smallest positive integer x with x ≡ 6 (mod 7) and x ≡ 4 (mod 8).
x ≡ 6 (mod 7)x ≡ 4 (mod 8)
x =
8.Number theory & modular arithmeticHard
Solve 36x ≡ 6 (mod 42). Give the smallest positive solution x.
36x ≡ 6 (mod 42)
x =
3Solutions
1.Propositional logic & proofs
Answer: ¬(b ∧ c) → ¬a
Logical equivalence: two formulas are equivalent (≡) when they have the same value in every row of the truth table. A tautology is 1 in every row, a contradiction is 0 in every row, and a contingency is neither. Useful laws: De Morgan, ¬(a ∧ b) ≡ ¬a ∨ ¬b and ¬(a ∨ b) ≡ ¬a ∧ ¬b; a → b ≡ ¬a ∨ b ≡ ¬b → ¬a (contrapositive); ¬(a → b) ≡ a ∧ ¬b; and the distributive laws, a ∨ (b ∧ c) ≡ (a ∨ b) ∧ (a ∨ c).
Parts of the implication
a = a, b = b ∧ c
Contrapositive
¬b → ¬a = ¬(b ∧ c) → ¬a
Answer
¬(b ∧ c) → ¬a
The contrapositive is equivalent to the original statement, so proving it proves the statement.
2.Propositional logic & proofs
Answer: p = 1, r = 1
Quantifiers and arguments: ¬∀x P(x) ≡ ∃x ¬P(x) and ¬∃x P(x) ≡ ∀x ¬P(x). Move a negation inwards, swap every quantifier it passes, and negate the inner formula with the propositional laws, such as ¬(a → b) ≡ a ∧ ¬b. An argument is valid when the conclusion is 1 in every row in which all premises are 1. A single row with true premises and a false conclusion is a counterexample and shows the argument is invalid.
Premises and conclusion row by row
p = 1, r = 1: 1 1 | 0
p = 1, r = 0: 1 0 | 0
p = 0, r = 1: 1 1 | 1
p = 0, r = 0: 0 0 | 1
Counterexample
p = 1, r = 1
Answer
p = 1, r = 1
An argument with this form looks like a valid rule, but one row is enough to show that it is not.
3.Sets, relations & functions
Answer: |(A′ − C)′| = 36
Sets and Venn diagrams: A ∪ B holds the elements in A or B (or both), A ∩ B the elements in both, A − B the elements of A that are not in B, and the complement A′ everything in U that is not in A. In a Venn diagram every set expression is a union of regions, so count it region by region. Inclusion–exclusion: |A ∪ B| = |A| + |B| − |A ∩ B|, and |A ∪ B ∪ C| = |A| + |B| + |C| − |A ∩ B| − |A ∩ C| − |B ∩ C| + |A ∩ B ∩ C|.
Regions of the expression
A ∩ B′ ∩ C′: 11
A ∩ B ∩ C′: 6
A′ ∩ B′ ∩ C: 1
A ∩ B′ ∩ C: 14
A′ ∩ B ∩ C: 3
A ∩ B ∩ C: 1
Add
|(A′ − C)′| = 11 + 6 + 1 + 14 + 3 + 1 = 36
Answer
|(A′ − C)′| = 36
4.Sets, relations & functions
Answer: (g ∘ f)(2) = 2
Functions and counting: a function f: A → B gives every element of A exactly one image in B. f is injective (one-to-one) when different elements have different images, surjective (onto) when every element of B is an image, and bijective when both hold. With |A| = m and |B| = n there are nᵐ functions, n!/(n − m)! injective ones (m ≤ n), and by inclusion–exclusion Σ (−1)ᵏ·C(n, k)·(n − k)ᵐ surjective ones. |𝒫(A)| = 2ᵐ and |A × B| = m·n.
Inner function
f(2) = 4
Outer function
g(4) = 2
(g ∘ f)(2) = 2
Answer
(g ∘ f)(2) = 2
5.Graph theory
Answer: k = 2
Euler, Hamilton and trees: a connected graph has an Euler circuit (every edge once, back to the start) when every vertex has even degree, and an Euler path that is not a circuit when exactly two vertices have odd degree; the path then runs from one odd vertex to the other. A Hamilton circuit visits every vertex once; Kn has (n − 1)!/2 of them. A tree on n vertices has n − 1 edges, and a connected graph with m edges keeps a spanning tree after removing m − n + 1 edges.
Edges of a spanning tree
15 − 1 = 14
Edges to remove
k = 16 − 14 = 2
Answer
k = 2
6.Graph theory
Answer: edge DE
Shortest paths and spanning trees: Dijkstra’s algorithm settles one vertex per round: the unsettled vertex with the smallest tentative distance. Its distance is then final, and every neighbour v gets d(v) = min(d(v), d(u) + w(u, v)). Kruskal’s algorithm builds a minimum spanning tree by taking the edges from light to heavy and skipping any edge that would close a cycle; Prim’s algorithm grows one tree from a start vertex by always adding the lightest edge that leaves it. A spanning tree of n vertices has n − 1 edges.
Prim’s algorithm
1. AB (7)
2. BE (6)
3. DE (8)
4. BC (11)
edge number 3
DE
Answer
edge DE
7.Number theory & modular arithmetic
Answer: x = 20
Inverses and congruences: a has an inverse modulo n exactly when gcd(a, n) = 1. The extended Euclidean algorithm writes 1 = s·n + t·a, and then a⁻¹ ≡ t (mod n). A congruence a·x ≡ b (mod n) with gcd(a, n) = 1 has the solution x ≡ a⁻¹·b. Two congruences x ≡ r₁ (mod m₁) and x ≡ r₂ (mod m₂) with coprime moduli have one solution modulo m₁·m₂ (Chinese remainder theorem). Euler’s φ(n) counts the numbers from 1 to n that are coprime to n: φ(n) = n·∏(1 − 1/p).
First congruence
x = 6 + 7k
Second congruence
6 + 7k ≡ 4 (mod 8) → 7k ≡ 6 (mod 8)
k ≡ 7·6 ≡ 2 (mod 8)
Result
x = 6 + 7·2 = 20
x = 20
check: 20 mod 7 = 6, 20 mod 8 = 4
Answer
x = 20
8.Number theory & modular arithmetic
Answer: x = 6
Inverses and congruences: a has an inverse modulo n exactly when gcd(a, n) = 1. The extended Euclidean algorithm writes 1 = s·n + t·a, and then a⁻¹ ≡ t (mod n). A congruence a·x ≡ b (mod n) with gcd(a, n) = 1 has the solution x ≡ a⁻¹·b. Two congruences x ≡ r₁ (mod m₁) and x ≡ r₂ (mod m₂) with coprime moduli have one solution modulo m₁·m₂ (Chinese remainder theorem). Euler’s φ(n) counts the numbers from 1 to n that are coprime to n: φ(n) = n·∏(1 − 1/p).