Solutions Week 5
Solutions Week 5
1
Lecturers: Dr Nguyen Hieu Thao & Dr Jeff Nijsse
Email: [email protected]
1 1
1. Compute wi , where wn = , ∀n ≥ 1.
P10
i=1 −
n n+1
Solution.
10
X 1 1 1 1 1 1
wi = w1 + w2 + · · · + w10 = − + − + ··· −
i=1
1 2 2 3 10 11
1 1 1 1 1 1 1 1 1 10
= + − + − + ··· − −− =1− = .
1 2 2 3 3 10 10 11 11 11
2. Compute the following quantities concerning the strings α = baab, β = caaba, γ = bbab.
Solution. λ (the null string), 0, 1, 00, 01, 10, 11, 000, 001, 010, 011, 100, 101, 110, 111.
Solution. The function f is one-to-one since for any strings α 6= β, it holds that
The function f is not onto since there is no string α such that f (α) = a since every element
of range(f ) must end with ab.
1 Some of the content of this document is taken from the book [1].
3.3 Exercises
In Exercises 1–4, write the relation as a set of ordered pairs. 14.
1.
8840 Hammer
9921 Pliers
2 452 Paint
2207 Carpet
6. Consider the grammar generating the language
2. of all integers in Notes Week 5. Give a
derivation of the signed integer +2081. Sally Math
Ruth Physics
Solution. Sam Econ
< integer > ⇒ < signed integer >
3.
⇒ + < unsigned integer >
a 3 15.
⇒ + < digit >< unsigned
b integer1>
⇒ + < digit >< digit ><
b unsigned
4 integer >
c 1 unsigned integer >
⇒ + < digit >< digit >< digit >< 16.
⇒ + < digit >< digit >< digit >< digit >
4.
⇒ +2 < digit >< digit >< digit >
a a
⇒ +20 < digit >< digitb> b 17.
⇒ +208 < digit >
❦
In Exercises 5–8, write the relation as a table.
⇒ +2081. Exer
5. R = {(a, 6), (b, 2), (a, 1), (c, 1)} defin
7. Write the relation R on {1, 2, 3, 4} given by (x, 6.
y) The iff x2 ≥
∈ Rrelation y {1, 2, 3, 4} defined by (x, y) ∈ R if x2 ≥ y
R on
18.
7. R = {(Roger, Music), (Pat, History), (Ben, Math),
as a table and draw its digraph. 20.
(Pat, PolySci)}
Solution. A table and a digraph of the relation is below.
8. The relation R from the set X of planets to the set Y of integers
defined by (x, y) ∈ R if x is in position y from the sun (nearest 21.
x 1 2 2 2 2 3 3 3 3 4 4the sun
4 being
4 in position 1, second nearest the sun being in
y 1 1 2 3 4 1 2 3 4 1 2position
3 2, 4 and so on) 22.
In Exercises 9–12, draw the digraph of the relation.
8. Draw the digraph of the relation 23.
9. The relation of Exercise 4 on {a, b, c}
R = {(1, 2), (2, 1), (3, 3), (1, 1), (2,10.2)}The relation R = {(1, 2), (2, 3), (3, 4), (4, 1)} on {1, 2, 3, 4} In E
11. The relation R = {(1, 2), (2, 1), (3, 3), (1, 1), (2, 2)} on the
X = {1, 2, 3} tran
on X = {1, 2, 3}.
12. The relation of Exercise 6 24.
Solution. The digraph is beside. In Exercises 13–16, write the relation as a set of ordered pairs. 25.
13. 26.
27.
a b
29.
9. Write the relation as a set of ordered pairs. 31.
32.
Solution. R = {(a, b), (a, c), (b, a), (b, d), (c, c), (c, d)}. 33.
35.
c d
10. Refer to the relation R on the set {1, 2, 3, 4, 5} given by (x, y) ∈ R iff 3 divides x − y. List
the elements of R−1 .
Solution. R−1 = {(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (1, 4), (4, 1), (2, 5), (5, 2)}. ❦
3
11. Determine whether each relation defined on the set of positive integers is reflexive, sym-
metric, antisymmetric, transitive, a partial order.
(b) (x, y) ∈ R if x − y = 2. R has none of the considered properties. Justify this statement
for yourself.
12. Let X be a nonempty set. Define a relation on P(X), the power set of X, as (A, B) ∈ R if
A ⊆ B. Is this relation reflexive, symmetric, antisymmetric, transitive, or a partial order?
13. Let R1 = {(1, 1), (1, 2), (3, 4), (4, 2)} and R2 = {(1, 1), (2, 1), (3, 1), (4, 4), (2, 2)} be relations
on {1, 2, 3, 4}. List the elements of R1 ◦ R2 and R2 ◦ R1 .
Solution. Looking at all the ordered pairs from the first set to the last set, we have that
R1 ◦ R2 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 1), (3, 2), (4, 2)}
R2 ◦ R1 = {(1, 1), (1, 2), (3, 4), (4, 1), (4, 2)} .
The digraphs of R1 ◦ R2 (R2 is computed first) and R2 ◦ R1 (R1 is computed first) are
respectively in figures (a) and (b) below.
(a) (b)
4
14. Give examples of relations on {1, 2, 3, 4} having the properties specified below.
15. Determine whether the given relation is an equivalence relation on {1, 2, 3, 4, 5}. If the
relation is an equivalence relation, list the equivalence classes.
(a) R = {(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (1, 3), (3, 1), (3, 4), (4, 3)}
Solution. It is not an equivalence relation since it is not transitive. Indeed, we have
(1, 3), (3, 4) ∈ R, but (1, 4) ∈
/ R.
(b) R = {(x, y) | x and y are both even or both odd}
Solution. It is an equivalence relation on {1, 2, 3, 4, 5}. There are two equivalence
classes: [1] = {1, 3, 5}, [2] = {2, 4}.
16. By listing ordered pairs, give an example of an equivalence relation on {1, 2, 3, 4, 5, 6} having
exactly four equivalence classes.
Solution. The following equivalence relation has exactly four equivalence classes:
R = {(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (1, 2), (2, 1), (3, 4), (4, 3)}.
The equivalence classes are [1] = {1, 2}; [3] = {3, 4}; [5] = {5}; [6] = {6}. There are
alternative solutions to this question.
17. How many equivalence relations are there on the set {1, 2, 3}?
Solution. The reflexive property requires that every equivalence relation on {1, 2, 3} must
contain (1, 1), (2, 2) and (3, 3). Then symmetric pairs can gradually and respectively be
added in such a way that the transitive property is not broken to obtain more equivalence
relations. The challenge is that this process must be exhaustive. There are five equivalence
relations on {1, 2, 3} as follows:
References
1. Johnsonbaugh, R.: Discrete Mathematics - Eighth Edition. Pearson Education, New York
(2018).