How many injective (one-to-one) functions f: A → B are there if |A| = 5 and |B| = 6? Call the number N.
|A| = 5|B| = 6
N =
5.Graph theoryMedium
Does the connected graph have an Euler circuit, an Euler path that is not a circuit, or neither? Click your answer.
|V| = 5|E| = 6
1Euler circuit
2Euler path, no circuit
3neither
6.Graph theoryHard
How many closed walks of length 2 start and end at B? A walk may repeat vertices and edges. Call the number N.
M = adjacency matrixL = 2
N =
7.Number theory & modular arithmeticMedium
Solve 17x ≡ 52 (mod 67). Give the solution x with 0 < x < 67.
17x ≡ 52 (mod 67)
x =
8.Number theory & modular arithmeticHard
An RSA key uses p = 19, q = 29 and e = 19. Decrypt the ciphertext c = 528: find the message m.
p = 19q = 29e = 19c = 528
m =
3Solutions
1.Propositional logic & proofs
Answer: contradiction
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).
Truth table row by row
p = 1, r = 1: r ∨ p = 1, ¬r = 0, ¬p = 0, ¬r ∧ ¬p = 0, (r ∨ p) ∧ (¬r ∧ ¬p) = 0
p = 1, r = 0: r ∨ p = 1, ¬r = 1, ¬p = 0, ¬r ∧ ¬p = 0, (r ∨ p) ∧ (¬r ∧ ¬p) = 0
p = 0, r = 1: r ∨ p = 1, ¬r = 0, ¬p = 1, ¬r ∧ ¬p = 0, (r ∨ p) ∧ (¬r ∧ ¬p) = 0
p = 0, r = 0: r ∨ p = 0, ¬r = 1, ¬p = 1, ¬r ∧ ¬p = 1, (r ∨ p) ∧ (¬r ∧ ¬p) = 0
Classify
(r ∨ p) ∧ (¬r ∧ ¬p): 0, 0, 0, 0
0 in every row: a contradiction.
Answer
contradiction
2.Propositional logic & proofs
Answer: N = 11
Truth tables: a formula with n different variables has 2ⁿ rows, one for every combination of truth values (1 = true, 0 = false). Work from the inside out and give every subformula its own column. ¬a flips the value; a ∧ b is 1 only when both are 1; a ∨ b is 0 only when both are 0; a → b is 0 only when a = 1 and b = 0; a ↔ b is 1 when both sides are equal.
Columns
d ↔ b; ¬c; (d ↔ b) ∨ ¬c; ¬a; c ∧ ¬a; ¬(c ∧ ¬a); d → ¬(c ∧ ¬a); ((d ↔ b) ∨ ¬c) ∧ (d → ¬(c ∧ ¬a))
Split on a
a = 1: 6
a = 0: 5
N = 6 + 5 = 11
Answer
N = 11
3.Sets, relations & functions
Answer: transitive
Relations: a relation R on a set X is a set of ordered pairs (x, y). R is reflexive when (x, x) ∈ R for every x in X; symmetric when (x, y) ∈ R always comes with (y, x) ∈ R; antisymmetric when (x, y) and (y, x) are both in R only if x = y; and transitive when (x, y) and (y, z) in R force (x, z) ∈ R. An equivalence relation is reflexive, symmetric and transitive, and splits X into disjoint classes.
reflexive
fails: (2, 2) ∉ R
symmetric
fails: (2, 1) ∈ R, (1, 2) ∉ R
antisymmetric
fails: (1, 3), (3, 1) ∈ R
transitive
holds
Answer
transitive
4.Sets, relations & functions
Answer: N = 720
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.
Count
N = 6!/(6 − 5)! = 720
Answer
N = 720
5.Graph theory
Answer: Euler circuit
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.
Degrees: the degree of a vertex is the number of edges that meet it. Every edge has two ends, so the degrees add up to twice the number of edges: Σ deg(v) = 2|E| (the handshake lemma). The number of vertices with odd degree is therefore even. Kn has n(n − 1)/2 edges, a k-regular graph on n vertices has nk/2, and a tree on n vertices has n − 1 edges.
Adjacency matrix
A: 0 1 1 0 0 0
B: 1 0 1 0 1 0
C: 1 1 0 0 1 0
D: 0 0 0 0 0 1
E: 0 1 1 0 0 1
F: 0 0 0 1 1 0
Common neighbours
(M²)BB = 1·1 + 0·0 + 1·1 + 0·0 + 1·1 + 0·0 = 3
Answer
N = 3
7.Number theory & modular arithmetic
Answer: x = 7
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).
Inverse of 17
r = 67, t = 0
r = 17, q = 3, t = 1
r = 16, q = 1, t = −3
r = 1, q = 16, t = 4
17−1 ≡ 4 (mod 67)
Solve
x ≡ 4·52 = 208 ≡ 7 (mod 67)
check: 17·7 = 119 ≡ 52 (mod 67)
Answer
x = 7
8.Number theory & modular arithmetic
Answer: m = 129
Modular powers and RSA: compute aᵏ mod n by repeated squaring: write k in binary, square, reduce after every step and multiply the powers whose bit is 1. Fermat: aᵖ⁻¹ ≡ 1 (mod p) for a prime p not dividing a, so the exponent can be reduced modulo p − 1. RSA: choose primes p and q, n = p·q and φ(n) = (p − 1)(q − 1); the public exponent e is coprime to φ(n), and the private exponent is d = e⁻¹ mod φ(n). Encrypt with c = mᵉ mod n and decrypt with m = cᵈ mod n.