Tutorial Exam Solution
Tutorial Exam Solution
Note: the final exam may or may not be related with the questions here.
Q1: Find a positive integer x in the range [1, 6] for each of the following:
I. 2x ≡ 1 mod 7
Solution:
21 mod 7 = 2
22 mod 7 = 4
23 mod 7 = 1
hence x = 3.
II. 3x ≡ 1 mod 7
Solution:
31 mod 7 = 3
32 mod 7 = 2
33 mod 7 = 6
34 mod 7 = 4
35 mod 7 = 5
36 mod 7 = 1
hence x = 6.
III. 4x ≡ 1 mod 7
Solution:
41 mod 7 = 4
42 mod 7 = 2
43 mod 7 = 1
hence x = 3.
IV. 5x ≡ 1 mod 7
Solution:
51 mod 7 = 5
52 mod 7 = 4
53 mod 7 = 6
54 mod 7 = 2
55 mod 7 = 3
56 mod 7 = 1
hence x = 6.
1
V. 6x ≡ 1 mod 7
Solution:
61 mod 7 = 6
62 mod 7 = 1
hence x = 2.
Q2: (optional) Is it generally true that xp−1 mod p = 1, for p a prime number and x a
positive integer with gcd(x, p) = 1 ?
Solution:This is related to Fermat’s little theorem, which states
xp ≡ x mod p
Q4: Let the set S = {1, 2, . . . , 6}, is S closed under operator ∆=“multiplication modulo 7”,
i.e., x∆y = x · y mod 7?
Solution: TURE. Because for any x, y ∈ S, 7 6 |x, 7 6 |y, and 7 is a prime, so 7 6 |x · y,
i.e., xy 6≡ 0 mod 7, then (x · y mod 7) ∈ S, hence “closed”.
Q5: Determine the truth value of the statement ∃x∀y(x ≤ y 2 ) if the domain for the variables
consists of
2
I. the positive real numbers.
Solution: FALSE. The negation
∀x∃y(x > y 2 )
p
is TRUE. ∀x ∈ R+ , one can choose y = x/2 ∈ R+ , such that x > y 2 = x/2.
Q6: Show that the premises “It is not sunny this afternoon and it is colder than yesterday,”
“We will go swimming only if it is sunny,” “If we do not go swimming, then we will
take a canoe trip,” and “If we take a canoe trip, then we will be home by sunset” lead
to the conclusion“We will be home by sunset.”
Solution: Let us denote the premises by
¬S ∧ C
¬S → ¬W
¬W → T
T →H
∴ H
3
¬S ∧ C
∴ ¬S (conjunctive simplification)
¬S
¬S → ¬W
∴ ¬W (Modus ponens)
¬W
¬W → T
∴ T (Modus ponens)
T
T →H
∴ H (Modus ponens)
Q7: Determine, using truth table, whether the following statement is valid
p → q ∨ ¬r
q → p∧r
∴p → r
row p q r q ∨ ¬r p ∧ r p → q ∨ ¬r q → p ∧ r p→r
1 T T T T T T T T
2 T T F T F T F F
3 T F T F T F T T
4 T F F T F T T F
5 F T T T F T F T
6 F T F T F T F T
7 F F T F F T T T
8 F F F T F T T T
The statement is false due to the fact that row 4 is a counter example.
Q8: Prove by mathematical induction that
1 1 1 n
+ + ··· + =
1·2 2·3 n · (n + 1) n+1
for all integers n ≥ 1.
1 1 1
Solution: Denote f (n) = 1·2
+ 2·3
+ ··· + n·(n+1)
.
4
1
Basis Step: n = 1, LHS = 1·2
= 21 , and RHS = 1
1+1
= 1
2
=LHS.
Inductive Step: assume n = k, the conclusion holds, i.e.,
1 1 1 k
f (k) = + + ··· + =
1·2 2·3 k · (k + 1) k+1
When n = k + 1,
1 1 1 1
f (k + 1) = 1·2 + 2·3 + · · · + k·(k+1) + (k+1)·(k+2)
1
= f (k) + (k+1)·(k+2)
k 1
= k+1 + (k+1)·(k+2)
1
= (k+1)·(k+2) · (k(k + 2) + 1)
1
= (k+1)·(k+2) · (k + 1)2
k+1
= k+2
= RHS
Overall, by mathematical induction, the conclusion is true for all integer n ≥ 1.
5
√
Basis Step: n = 2, f (2) = √1 + √1 , and RHS = 2 < f (2), TRUE.
1 2
Inductive Step: assume n = k, the conclusion holds, i.e.,
√
f (k) > k
When n = k + 1,
f (k + 1) = √1 + √12 + · · · + √1k + √1
1 k+1
1
= f (k) + + √k+1
√ 1
> k + √k+1
√ 1 √
> k + √k+1+
√ √ k √
= √ k + ( k + 1 − k)
= k+1
√
Overall, f (n) > n for all integer n ≥ 2. (Take note the trick used by the red
step)
Q11: Let relation R defined on set A = {a, b, c, d} and R = {(a, b), (b, a), (b, c), (c, d)}, find
R−1 , R2 (note: R2 = R ◦ R), R3 and the transitive closure Rt . Is Rt an equivalent
relation or a partial order ?
Solution:
6
– (b, a), (a, b) ∈ R, hence (b, b) ∈ Rt
– (b, c) ∈ R, hence (b, c) ∈ Rt
– (b, c), (c, d) ∈ R, hence (b, d) ∈ Rt
– (c, d) ∈ R, hence (c, d) ∈ Rt
Hence Rt = {(a, a), (a, b), (a, c), (a, d), (b, a), (b, b), (b, c), (b, d), (c, d)}
• Rt is neither an equivalent relation, nor a partial order, since (c, c), (d, d) 6∈ Rt and
Rt is not reflexive.
Q12: Prove using both set identities and membership table that
(A − B) ∩ (C − B) = (A ∩ C) − B
A B C A−B C −B (A − B) ∩ (C − B) A∩C (A ∩ C) − B
1 1 1 0 0 0 1 0
1 1 0 0 0 0 0 0
1 0 1 1 1 1 1 1
1 0 0 1 0 0 0 0
0 1 1 0 0 0 0 0
0 1 0 0 0 0 0 0
0 0 1 0 1 0 0 0
0 0 0 0 0 0 0 0
Q13: Show that in a group of five people (where any two people are either friends or enemies),
there are not necessarily three mutual friends or three mutual enemies.
Solution: Let (x, y) denote x and y are friends, if (x, y) does not exist, then there are
enemies. Denote the five people as A, B, C, D, E, if we denote the 5 people as nodes, and
friendship as edges, then they form a graph, and three mutual friends imply a complete
7
sub-graph of 3 nodes, and three mutual enemies imply three nodes without any edge in
between.
If the friendships are between (A, B), (B, C), (C, D), (D, E), (E, A), then none of the
two cases happens.
Q14: Let f, g : R → R, and f (x) = x − 3 and g(x) = x3 + 10, find f −1 ◦ g −1 and (g ◦ f )−1 ,
what do you find ?
√ √
Solution: Let y = x3 + 10, hence x = 3 y − 10, g −1 (x) = 3 x − 10
Let y = x − 3, hence x = y + 3, f −1 (x) = x √+ 3 √
Hence, f −1 ◦ g −1 (x) = f −1 (g −1 (x)) = f −1 ( 3 x − 10) = 3 x − 10 + 3
g◦f
√ (x) = g(f (x)) = g(x−3)
√ = (x−3)3 +10. Let y = (x−3) √
3
+10, then y−10 = (x−3)3 ,
−1 3
3
y − 10 = x − 3, x = y − 10 + 3, hence (g ◦ f ) (x) = x − 10 + 3
3
Q15: Find the Euler path, Euler circuit, Hamilton path, and Hamilton circuit of the following
graphs (with a and b as starting and ending points for paths), if any.
Solution:
8
• G3 : the degrees are deg(a) = deg(d) = deg(f ) = 1, deg(b) = deg(c) = deg(e) = 3,
deg(g) = 2
– Euler Path: does not exist, more than 2 nodes are of odd degrees
– Euler Circuit: does not exist, due to odd degrees
– Hamilton Path: does not exist, more than 2 nodes of degree 1
– Hamilton Circuit: does not exist, due to existence of degree 1.