Discrete Structure Assignment No. 2: Submitted To
Discrete Structure Assignment No. 2: Submitted To
Discrete Structure Assignment No. 2: Submitted To
DISCRETE STRUCTURE
ASSIGNMENT NO. 2
Submitted to:
Sir Zafar Iqbal
Name:
Esha Baig
Registration no:
UET-18F-BSCE-18
Department:
BSCE
Semester:
4
Date:
st
1 June, 2020
Day:
Monday
1|Page
Discrete Structure Assignment no. 4
Question no. 1
Let A = {a, b, c}, B = {x, y}, and C = {0, 1}. Find
a) A × B × C. b) C × B × A.
c) C × A × B. d) B × B × B.
a) A × B × C.
Solution:-
Using the definition of the Cartesian product, we know that A x B x C are ordered triplets of
any combination of the elements in each set (in the same order as the sets in the Cartesian
product).
A x B x C.={(a,x , 0), (a, x ,1), (a, y , 0), (a,y , 1), (b, x , 0), (b, x , 1), (b, y,0),(b, y,1), (c, x ,0), (c,
x , 1), (c, y, 0), (c, y, 1)}
b) C × B × A
Solution:-
Using the definition of the Cartesian product, we know that C x B x A are ordered triplets of
any combination of the elements in each set (in the same order as the sets in the Cartesian
product).
C x B x A = { (0, x, a), (0, x, b), (0, x, c), (0, y, a), (0, y, b), (0, y, c), (1,x,a), (1,x,b),(1,x,c),(1,y,a),
(1,y, b), (1,y,c)}
c) C × A × B.
Solution:-
Using the definition of the Cartesian product, we know that C x A x B are ordered triplets of
any combination of the elements in each set (in the same order as the sets in the Cartesian
product).
C x A x B = {(0, a, x), (0,a, y), (0, b, x), (0, b, y), (0,c, x), (0, c, y), (1,a, x), (1,a, y), (1, b,x),(1,b,
y), (1, c, s),(1,c,y)}
d) B × B × B.
Solution:-
Using the definition of the Cartesian product, we know that B x B x B are ordered triplets of
any combination of the elements in each set (in the same order as the sets in the Cartesian
product).
B x B x B = {(x, x, x),(x, x, y), (x, y, x), (x, y, y), (y, x, x), (y, x, 0, (y, y, x),(y,y,y)}
Question no. 2
Let A, B, and C be sets. Show that
Solution:-
We have,
2|Page
Discrete Structure Assignment no. 4
Question no. 3
Use a membership table to show that A∩(B ∪C)= (A∩B)∪(A∩C).
Solution:-
A B C 𝐁∪𝐂 A∩ (𝐁 ∪ 𝐂) A∩ 𝐁 A∩ 𝐂 (A∩ 𝐁) ∪ (𝐀 ∩ 𝐂)
1 1 1 1 1 1 1 1
1 1 0 1 1 1 0 1
1 0 1 1 1 0 1 1
1 0 0 0 0 0 0 0
0 1 𝟏 1 0 0 0 0
0 1 0 1 0 0 0 0
0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0
Question no. 4
Let A = {0, 2, 4, 6, 8}, B = {0, 1, 2, 3, 4}, and C = {0, 3, 6, 9}. What are A ∪ B ∪ C and A ∩ B ∩ C
?
Solution:-
The set 𝐀 ∪ 𝐁 ∪ 𝐂 contains those elements in at least one of A, B, and C.
Hence, 𝐀 ∪ 𝐁 ∪ 𝐂 = { 𝟎, 𝟏, 𝟐, 𝟑, 𝟒, 𝟔, 𝟖, 𝟗}.
The set 𝐀 ∩ 𝐁 ∩ 𝐂 contains those elements in all three of A, B, and C.
Thus, 𝐀 ∩ 𝐁 ∩ 𝐂 = {𝟎}.
We can also consider unions and intersections of an arbitrary number of sets.
We introduce these definitions.
Question no. 5
The bit strings for the sets {1, 2, 3, 4, 5} and {1, 3, 5, 7, 9} are 11 1110 0000 and 10 1010
1010, respectively. Use bit strings to find the union and intersection of these sets.
Solution:-
The bit string for the union of these sets is
11 1110 0000 ∨ 10 1010 1010 = 11 1110 1010, which corresponds to the set {1,2,3,4,5,7,9}.
Question no. 6
Let f1 and f2 be functions from R to R such that f1 (x) = x2 and f2 (x) = x − x2. What are the
functions f1 + f2 and f1 f2?
Solution:-
From the definition of the sum and product of functions, it follows that
(𝐟𝟏 + 𝐟𝟐 )(𝐱) = 𝐟𝟏 (𝐱) + 𝐟𝟐 (𝐱) = 𝐱 𝟐 + (𝐱 − 𝐱 𝟐 ) = 𝐱
3|Page
Discrete Structure Assignment no. 4
and
(𝐟𝟏 𝐟𝟐 )(𝐱) = 𝐱 𝟐 (𝐱 − 𝐱 𝟐 ) = 𝐱 𝟑 − 𝐱 𝟒
When f is a function from A to B, the image of a subset of A can also be defined.
Question no. 7
Let f and g be the functions from the set of integers to the set of integers defined by f (x) =
2x + 3 and g(x) = 3x + 2. What is the composition of f and g? What is the composition of g
and f ? 147
Solution:-
Both the compositions 𝐟 𝐨 𝐠 and 𝐠 𝐨 𝐟 are defined. Moreover,
(𝐟 𝐨 𝐠)(𝐱) = 𝐟(𝐠(𝐱)) = 𝐟(𝟑𝐱 + 𝟐) = 𝟐(𝟑𝐱 + 𝟐) + 𝟑 = 𝟔𝐱 + 𝟕
and
(𝐠 𝐨 𝐟)(𝐱) = 𝐠(𝐟(𝐱)) = 𝐠(𝟐𝐱 + 𝟑) = 𝟑(𝟐𝐱 + 𝟑) + 𝟐 = 𝟔𝐱 + 𝟏𝟏
Question no. 8
Let {an} be a sequence that satisfies the recurrence relation an = an−1 + 3 for n = 1, 2, 3, . . .
, and suppose that a0 = 2. What are a1, a2, and a3?158
Solution:-
We see from the recurrence relation that a1 = a0 +3=2+3=5. It then follows that a2 =5+3=8
and a3 =8+3=11.
Question no. 9
Let {an} be a sequence that satisfies the recurrence relation an = an−1 − an−2 for n = 2, 3, 4,
. . . , and suppose that a0 = 3 and a1 = 5. What are a2 and a3?
Solution:-
We see from the recurrence relation that a2 = a1−a0 =5−3=2 and a3 = a2 − a1 =2−5=−3. We
can find a4, a5, and each successive term in a similar way
Solution:-
We have
𝟓
∑ 𝐣 𝟐 = 𝟏 𝟐 + 𝟐𝟐 + 𝟑𝟐 + 𝟒𝟐 + 𝟓𝟐
𝐣=𝟏
= 𝟏 + 𝟒 + 𝟗 + 𝟏𝟔 + 𝟐𝟓
= 𝟓𝟓
Question no. 11
What is the value of the following summation? ∑𝟐𝐢=𝟏 ∑𝟑𝐣=𝟏 𝐢𝐣
Solution:-
∑𝟐𝐢=𝟏 ∑𝟑𝐣=𝟏 𝐢𝐣 = ∑𝟐𝐢=𝟏(𝐢 + 𝟐𝐢 + 𝟑𝐢)
4|Page
Discrete Structure Assignment no. 4
= ∑𝟐𝐢=𝟏 𝟔𝐢
= 𝟔 + 𝟏𝟐
= 𝟏𝟖
Question no. 12
a) A B
𝐀
Solution:-
𝟏 𝟎 𝟏 𝟎 𝟏 𝟏
[
𝐀𝐁 = 𝟏 𝟏 𝟎] [𝟏 𝟎 𝟏]
𝟎 𝟎 𝟏 𝟏 𝟎 𝟏
𝟏 𝟏 𝟏
𝐀𝐁 = [𝟏 𝟏 𝟏]
𝟎 𝟎 𝟏
b) A B
Solution:-
𝟏 𝟎 𝟏 𝟎 𝟏 𝟏
𝐀𝐁 = [𝟏 𝟏 𝟎 ] [ 𝟏 𝟎 𝟏]
𝟎 𝟎 𝟏 𝟏 𝟎 𝟏
𝟏 𝟏 𝟏
𝐀𝐁 = [𝟏 𝟏 𝟎]
𝟏 𝟎 𝟏
5|Page
Discrete Structure Assignment no. 4
c) A ⊙ B
Solution:-
𝟏 𝟎 𝟏 𝟎 𝟏 𝟏
𝐀 ⊙ 𝐁 = [𝟏 𝟏 𝟎 ] ⊙ [𝟏 𝟎 𝟏]
𝟎 𝟎 𝟏 𝟏 𝟎 𝟏
𝟏 𝟏 𝟏
𝐀 ⊙ 𝐁 = [𝟏 𝟏 𝟏]
𝟏 𝟎 𝟏
Question no. 13
Find the Boolean product of A and B, where
Solution:-
Let suppose
𝟏 𝟎
𝟏 𝟏 𝟎
𝐀 ⊙ 𝐁 = [𝟎 𝟏 ] ⊙ [ ]
𝟎 𝟏 𝟏
𝟏 𝟎
𝟏 𝟏 𝟎
𝐀 ⊙ 𝐁 = [𝟎 𝟏 𝟏]
𝟏 𝟏 𝟎
6|Page
Discrete Structure Assignment no. 4
We can also define the Boolean powers of a square zero–one matrix. These powers will
be used in our subsequent studies of paths in graphs, which are used to model such things
as communications paths in computer networks.
Question no. 14
Find the join and meet of the zero–one matrices
Solution:-
𝟏 𝟎 𝟏 𝟎 𝟏 𝟎
𝐀𝐁 = [ ][ ]
𝟎 𝟏 𝟎 𝟏 𝟏 𝟎
𝟏 𝟎 𝟎 𝟏 𝟏 𝟎
𝐀𝐁 = [ ]
𝟎𝟏 𝟏 𝟏 𝟎 𝟎
𝟏 𝟏 𝟏
𝐀𝐁 =[ ]
𝟏 𝟏 𝟎
𝟏 𝟎 𝟏 𝟎 𝟏 𝟎
A B = [ ] [ ]
𝟎 𝟏 𝟎 𝟏 𝟏 𝟎
𝟏𝟎 𝟎𝟏 𝟏 𝟎
A B = [ ]
𝟎 𝟏 𝟏 𝟏 𝟎 𝟎
𝟎 𝟎 𝟎
A B = [ ]
𝟏 𝟏 𝟎
Question no. 15
Let A = {1, 2, 3} and B = {1, 2, 3, 4}. The relations R1 = {(1, 1), (2, 2), (3, 3)} and R2 = {(1, 1),
(1, 2), (1, 3), (1, 4)}, Find
a) R1 ∪ R2 b) R1 ∩ R2
c) R1 − R2. d) R2 − R1 579
a) R1 ∪ R2
Solution:-
R1∪R2 ={ (1,1),(1,2),(1,3),(1,4),(2,2),(3,3)}
b) R1 ∩ R2
Solution:-
R1∩R2 ={ (1,1)}
7|Page
Discrete Structure Assignment no. 4
c) R1 − R2.
Solution:-
R1−R2 ={ (2,2),(3,3)}
d) R2 − R1
Solution:-
R2 −R1 ={ (1,2),(1,3),(1,4)}.
Question no. 16
Suppose that the relations R1 and R2 on a set A are represented by the matrices
1 0 1 1 0 1
MR1∪ MR2 = MR1 MR2 = [1 0 0 ] [0 1 1]
0 1 0 1 0 0
1 0 1 1 0 1
MR1∩ MR2 = MR1 MR2 = [1 0 0 ] [ 0 1 1]
0 1 0 1 0 0
𝟏 𝟎 𝟏
MR1∩ MR2 = [𝟏 𝟎 𝟏]
𝟎 𝟏 𝟏
Question # 17
Find the matrix representing the relations S o R, where the matrices representing R and S
are
8|Page
Discrete Structure Assignment no. 4
Solution:-
The matrix for S◦R is
MS o R = MR ⊙ MS.
𝟏 𝟏 𝟏
M R ⊙ M S = [𝟎 𝟏 𝟏]
𝟎 𝟎 𝟎
The matrix representing the composite of two relations can be used to find the matrix for MRn
.
In particular, MRn = M[n] R ,
Question # 18 Let A={1,2,3,4}. Define a relation R on A as R={(1,1), (1,2), (2,3), (3,2), (4,4)}.
Find the transitive closure of R
Solution:-
Question # 19 Let A = {1, 2, 3, 4} & define relations R1, R2, R3 and R4 on A by the directed
graphs:
R1 = {(1, 1), (1, 3), (2, 4), (3, 1), (4,2)}
R2 = {(1, 1), (2, 2), (3, 3), (4, 4)}
R3 = {(2, 2), (2, 3), (3, 4)}
R4 = {(1, 1), (2, 2), (3, 3), (4, 3), (4, 4)}
Solution:-
A={1,2,3,4}.
R={(1,1), (1,2), (2,3), (3,2), (4,4)}
(1,2).
(2,1). Symmetric.
(3,1).
(1,3).
9|Page
Discrete Structure Assignment no. 4
Now,
Rt = {(1,1), (1,2), (1,3), (2,2), (2,3), (3,2), (3,3), (4,4)}.
2 4
Directed graph:
2 4
10 | P a g e
Discrete Structure Assignment no. 4
3 4
R4 = {(1, 1), (2, 2), (3, 3), (4, 3), (4, 4)}
Directed graph:
2 4
11 | P a g e
Discrete Structure Assignment no. 4
Question no. 20
Find the first five terms of the sequence and determine if it is arithmetic.
an = 1 + (n – 1)4
Solution:-
an = a1+(n-1)d
12 | P a g e
Discrete Structure Assignment no. 4
a5 = 1+(5-1)4.
a5 = 1+4(4).
a5 = 1+16.
a5 = 17.
THE END
13 | P a g e