Discrete Mathematics
3. MATRICES, RELATIONS, AND FUNCTIONS
Lecture 5
Dr.-Ing. Erwin Sitompulhttp://zitompul.wordpress.com
5/2Erwin Sitompul Discrete Mathematics
Prove that for arbitrary sets A and B, the following set equation apply:a) A (A B) = A Bb) A (A B) = A B
Homework 4
5/3Erwin Sitompul Discrete Mathematics
Solution: a) A (A B) = (A A) (A B) Distributive Laws
= U (A B) Complement Laws = A B Identity Laws
Solution of Homework 4
b) A (A B) = (A A) (A B) Distributive Laws = (A B) Complement Laws
= A B Identity Laws
5/4Erwin Sitompul Discrete Mathematics
Matrices
A matrix is a structure of scalar elements in rows and columns.
The size of a matrix A is described by the number of rows m and the number of columns n, (m,n).
The square matrix is a matrix with the size of nn. Example of a matrix, with the size of 34, is:
11 12 1
21 22 2
1 2
n
n
m m mn
a a a
a a aA
a a a
2 5 0 6
8 7 5 4
3 1 1 8
A
5/5Erwin Sitompul Discrete Mathematics
The symmetric matrix is a matrix with aij = aji for each i and j.
The zero-one (0/1) matrix is a matrix whose elements has the value of either 0 or 1.
2 6 6 4
6 3 7 3
6 7 0 2
4 3 2 8
A
0 1 1 0
0 1 1 1
0 0 0 0
1 0 0 1
A
Matrices
5/6Erwin Sitompul Discrete Mathematics
A binary relation R between set A and set B is an improper subset of A B.
Notation: R (A B) a R b is the notation for (a,b) R, with the meaning “relation
R relates a with b.” a R b is the notation for (a,b) R, with the meaning “relation
R does not relate a with b.” Set A is denoted as the domain of R.
Set B is denoted as the range of R.
Relations
5/7Erwin Sitompul Discrete Mathematics
Example:Suppose A = { Amir, Budi, Cora } B = { Discrete Mathematics (DM), Data Structure and Algorithm (DSA), State Philosophy (SP), English III (E3) }
AB = { (Amir,DM), (Amir, DSA), (Amir,SP), (Amir,E3), (Budi,DM), (Budi, DSA), (Budi,SP), (Budi,E3), (Cora,DM), (Cora, DSA), (Cora,SP), (Cora,E3) }
Suppose R is a relation that describes the subjects taken by a certain IT students in the May-August semester, that is: R = { (Amir,DM), (Amir, SP), (Budi,DM), (Budi,E3),
(Cora,SP) }It can be seen that: R (A B) A is the domain of R, B is the range of R (Amir,DM) R or Amir R DM (Amir,DSA) R or Amir R DSA
Relations
5/8Erwin Sitompul Discrete Mathematics
Example:Take P = { 2,3,4 } Q = { 2,4,8,9,15 }
If the relation R from P to Q is defined as:(p,q) R if p is the factor of q,
then the followings can be obtained: R = { (2,2),(2,4),(2,8),(3,9),(3,15),(4,4),(4,8) }.
Relations
5/9Erwin Sitompul Discrete Mathematics
Example:Suppose R is a relation on A = { 2,3,4,8,9 } which is defined by (x,y) R if x is the prime factor of y,
then we can obtain the relation: R = { (2,2),(2,4),(2,8),(3,3),(3,9) }.
The relation on a set is a special kind of relation. That kind of relation on a set A is a relation of A A. The relation on the set A is a subset of A A.
Relations
5/10Erwin Sitompul Discrete Mathematics
1. Representation using arrow diagrams
Representation of Relations
5/11Erwin Sitompul Discrete Mathematics
2. Representation using tables
Representation of Relations
5/12Erwin Sitompul Discrete Mathematics
3. Representation using matrices Suppose R is a relation between A = { a1,a2, …,am } and
B = { b1,b2, …,bn }. The relation R can be presented by the matrix M = [mij]
where:
1 11 12 1
2 21 22 2
1 2
n
n
m m m mn
a m m m
a m m mM
a m m m
1 2 nb b b
1, ( , )
0, ( , )i j
iji j
a b Rm
a b R
Representation of Relations
5/13Erwin Sitompul Discrete Mathematics
1 0 1 0
1 0 0 1
0 0 1 0A BM
1 1 1 0 0
0 0 0 1 1
0 1 1 0 0P QM
1 0 1 1 0
0 1 0 0 1
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
A AM
a1 = Amir, a2 = Budi, a3 = Cora, and b1 = DM, b2 = DSA, b3 = SP, b4 = E3
p1 = 2, p2 = 3, p3 = 4, and q1 = 2, q2 = 4, q3 = 8, q4 = 9, q5 = 15
a1 = 2, a2 = 3, a3 = 4, a4 = 8, a5 = 9
Representation of Relations
5/14Erwin Sitompul Discrete Mathematics
4. Representation using directed graph (digraph) Relation on one single set can be represented graphically by
using a directed graph or digraph.
Digraphs are not defined to represent a relation from one set to another set.
Each member of the set is marked as a vertex (node), and each relation is denoted as an arc (bow).
If (a,b) R, then an arc should be drawn from vertex a to vertex b. Vertex a is called initial vertex while vertex b terminal vertex.
The pair of relation (a,a) is denoted with an arch from vertex a to vertex a itself. This kind of arc is called a loop.
Representation of Relations
5/15Erwin Sitompul Discrete Mathematics
Example:Suppose R = { (a,a),(a,b),(b,a),(b,c),(b,d),(c,a),(c,d),(d,b) } is a relation on a set { a,b,c,d },
then R can be represented by the following digraph:
Representation of Relations
5/16Erwin Sitompul Discrete Mathematics
Binary Relations The relations on one set is also called binary relation.
A binary relation may have one or more of the following properties:
1.Reflexive2.Transitive3.Symmetric4.Anti-symmetric
5/17Erwin Sitompul Discrete Mathematics
1. Reflexive Relation R on set A is reflexive
if (a,a) R for each a A.
Relation R on set A is not reflexive if there exists a A such that (a,a) R.
Example:Suppose set A = { 1,2,3,4 }, and a relation R is defined on A, then: (a) R = { (1,1),(1,3),(2,1),(2,2),(3,3),(4,2),(4,3),(4,4) } is reflexive because there exist members of the relation with the form (a,a) for each possible a, namely
(1,1), (2,2), (3,3), and (4,4).(b) R = { (1,1),(2,2),(2,3),(4,2),(4,3),(4,4) }
is not reflexive because (3,3) R.
Binary Relations
5/18Erwin Sitompul Discrete Mathematics
Example:Given a relation “divide without remainder” for a set of positive integers, is the relation reflexive or not?
Each positive integer can divide itself without remainder (a,a) R for each a A the relation is reflexive
Example:Given two relations on a set of positive integers N:
S : x + y = 4, T : 3x + y = 10Are S and T reflexive or not?
S is not reflexive, because although (2,2) is a member of S, there exist (a,a) S for a N, such as (1,1), (3,3), ....
T is not reflexive because there is even no single pair (a,a) T that can fulfill the relation.
Binary Relations
5/19Erwin Sitompul Discrete Mathematics
If a relation is reflexive, then the main diagonal of the matrix representing it will have the value 1, or mii = 1, for i = 1, 2, …, n.
The digraph of a reflexive relation is characterized by the loop on each vertex.
1
1
1
1
Binary Relations
5/20Erwin Sitompul Discrete Mathematics
2. Transitive Relation R on set A is transitive
if (a,b) R and (b,c) R, then (a,c) R for all a, b, c A.
Binary Relations
5/21Erwin Sitompul Discrete Mathematics
Example:Suppose A = { 1, 2, 3, 4 }, and a relation R is defined on set A, then: (a) R = { (2,1),(3,1),(3,2),(4,1),(4,2),(4,3) }
is transitive.
(b) R = { (1,1),(2,3),(2,4),(4,2) } is not transitive because (2,4) and (4,2) R, but (2,2) R, also (4,2) and (2,3) R, but (4,3) R.
(c) R = { (1,2), (3,4) } is transitive because there is no violation against the
rule { (a,b) R and (b,c) R } (a,c) R.
Relation with only one member such as R = { (4,5) } is always transitive.
Binary Relations
5/22Erwin Sitompul Discrete Mathematics
Example:Is the relation “divide without remainder” on a set of positive integers transitive or not?
It is transitive.
Suppose that a divides b without remainder and b divides c without remainder, then certainly a divides c without remainder.
{ a R b b R c } a R c
Example:Given two relations on a set of positive integers N:
S : x + y = 4, T : 3x + y = 10Are S and T transitive or not?
S is not transitive, because i.e., (3,1) and (1,3) are members of S, but (3,3) and (1,1) are not members of S.
T = { (1,7),(2,4),(3,1) } not transitive because (3,7) R.
Binary Relations
5/23Erwin Sitompul Discrete Mathematics
Relation R on set A is symmetric if (a,b) R, then (b,a) R for all a,b A.
Relation R on set A is not symmetric if there exists (a,b) R such that (b,a) R.
Relation R on set A such that if (a,b) R and (b,a) R then a = b for a,b A, is called anti-symmetric.
Relation R on set A is not anti-symmetric if there exist different a and b such that (a,b) R and (b,a) R.
3. Symmetric and Anti-symmetric
Symmetric relation
Anti-symmetric relation
Binary Relations
5/24Erwin Sitompul Discrete Mathematics
Example:Suppose A = { 1,2,3,4 }, and relation R is defined on set A, then: (a) R = { (1,1),(1,2),(2,1),(2,2),(2,4),(4,2),(4,4) }
is symmetric,because if (a,b) R then (b,a) R also .Here, (1,2) and (2,1) R, as well as (2,4) and (4,2) R. is not anti-symmetric,because i.e., (1,2) R and (2,1) R while 1 2.
(b) R = { (1,1),(2,3),(2,4),(4,2) } is not symmetric,because (2,3) R, but (3,2) R.is not anti-symmetric,because there exists (2,4) R and (4,2) R while 2 4.
Binary Relations
5/25Erwin Sitompul Discrete Mathematics
Example:Suppose A = { 1,2,3,4 }, and relation R is defined on set A, then: (c) R = { (1,1),(2,2),(3,3) }
is symmetric and anti-symmetric, because (1,1) R and 1 = 1, (2,2) R and 2 = 2, and (3,3) R and 3 = 3.
(d) R = { (1,1),(1,2),(2,2),(2,3) } is not symmetric,because (2,3) R, but (3,2) R.is anti-symmetric,because (1,1) R and 1 = 1 and, (2,2) R and 2 = 2.
Binary Relations
5/26Erwin Sitompul Discrete Mathematics
Example:Suppose A = { 1,2,3,4 }, and relation R is defined on set A, then: (e) R = { (1,1),(2,4),(3,3),(4,2) }
is symmetric.is not anti-symmetric,because there exist (2,4) and (4,2) as member of R while2 4.
(f) R = { (1,2),(2,3),(1,3) } is not symmetric.is anti-symmetric,because there is no different a and b such that (a,b) R
and (b,a) R (which will violate the anti-symmetric rule).
Binary Relations
5/27Erwin Sitompul Discrete Mathematics
Relation R = { (1,1),(2,2),(2,3),(3,2),(4,2),(4,4)} is not symmetric and not anti-symmetric.
R is not symmetric, because (4,2) R but (2,4) R.
R is not anti-symmetric,because (2,3) R and (3,2) R but 2 3.
Binary Relations
5/28Erwin Sitompul Discrete Mathematics
Example:Is the relation “divide without remainder” on a set of positive integers symmetric? Is it anti-symmetric?
It is not symmetric,because if a divides b without remainder, then b cannot divide a without remainder, unless if a = b. For example, 2 divides 4 without remainder, but 4 cannot divide 2 without remainder. Therefore, (2,4) R but (4,2) R.
It is anti-symmetric,because if a divides b without remainder, and b divides a without remainder, then the case is only true for a = b. For example, 3 divides 3 without remainder, then (3,3) R and 3 = 3.
Binary Relations
5/29Erwin Sitompul Discrete Mathematics
Example:Given two relations on a set of positive integers N:
S : x + y = 4, T : 3x + y = 10Are S and T symmetric? Are they anti-symmetric?
S is symmetric, because take (3,1) and (1,3) are members of S.
S is not anti-symmetric, because although there exists(2,2) R, but there exist also { (3,1),(1,3) } R while 3 1.
T = { (1,7),(2,4),(3,1) } not symmetric.T = { (1,7),(2,4),(3,1) } anti-symmetric.
Binary Relations
5/30Erwin Sitompul Discrete Mathematics
If R is a relation from set A to set B,
then the inverse of relation R, denoted with R–1, is the relation from set B to set A defined by:
R–1 = { (b,a) | (a,b) R }.
Inverse of Relations
5/31Erwin Sitompul Discrete Mathematics
Example:SupposeP = { 2,3,4 } Q = { 2,4,8,9,15 }.
If the relation R from P to Q is defined by:(p,q) R if p divides q without remainder,
then the members of the relation can be obtained as: R = { (2,2),(2,4),(2,8),(3,9),(3,15),(4,4),(4,8) }.
R–1, the inverse of R, is a relation from Q to P with:(q,p) R–1 if q is a multiplication of p.
It can be obtained that: R–1 = { (2,2),(4,2),(8,2),(9,3),(15,3),(4,4),(8,4) }.
Inverse of Relations
5/32Erwin Sitompul Discrete Mathematics
1 1 1 0 0
0 0 0 1 1
0 1 1 0 0P QM
If M is a matrix representing a relation R,
then the matrix representing R–1, say N, is the transpose of matrix M.
T
1 0 0
1 0 1
1 0 1
0 1 0
0 1 0
Q P P QN M
N = MT, means that the rows of M becomes the columns of N
Inverse of Relations
5/33Erwin Sitompul Discrete Mathematics
Homework 5
For each of the following relations on set A = { 1,2,3,4 }, check each of them whether they are reflexive, transitive, symmetric, and/or anti-symmetric: (a) R = { (2,2),(2,3),(2,4),(3,2),(3,3),(3,4) } (b) S = { (1,1),(1,2),(2,1),(2,2),(3,3),(4,4) } (c) T = { (1,2),(2,3),(3,4) }
No.1:
No.2: Represent the relation R, S, and T using matrices and digraphs.
Top Related