SlideShare ist ein Scribd-Unternehmen logo
1 von 9
Downloaden Sie, um offline zu lesen
Relations - 08                                                               CSC1001 Discrete Mathematics             1

 CHAPTER
                                                           ความสัมพันธ์
       8                                                    (Relations)

  1       Relations and Their Properties
1. Relation Deffinitions
   The most direct way to express a relationship between elements of two sets is to use ordered pairs made
up of two related elements.
  Definition 1

 Let A and B be sets. A binary relation from A to B is a subset of A × B.

Example 1 (2 points) Let A = {0, 1, 2} and B = {a, b}. Then {(0, a), (0, b), (1, a), (2, b)} is a relation from A to B.
This means, for instance, that 0 R a, but that 1 not R b. Relations can be represented graphically using arrows
to represent ordered pairs. Another way to represent this relation is to use a table.




Example 2 (2 points) Let A be the set of cities in the ASEAN, and let B be the set of countries in the ASEAN
as follow list;
A = { Bangkok, Johor, Manila, Kuala Lumpur, Hanoi, Phuket, Penang, Naypyidaw, Ho Chi Minh, Chiang Mai }
B = { Malaysia, Thailand, Philippines, Vietnam, Myanmar }
Find the relations from A to B.




Example 3 (2 points) Let A = { 0, 1, 4 } is domain of f(x) and B = { -2, -1, 0, 1, 2 } is range of f(x), find the
relations from A to B, if given f(x) = x .




มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555)                                     เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
2         CSC1001 Discrete Mathematics                                                                  08 - Relations


2. Relations on a Set
    Definition 2

    A relation on a set A is a relation from A to A. In other words, a relation on a set A is a subset of A × A.

Example 4 (2 points) Let A be the set {1, 2, 3, 4}. Which ordered pairs are in the relation R = {(a, b) | a divides
b} for example 2 divides 4?




Example 5 (4 points) From Example 4 draw all relations by using arrows and table to represent ordered pairs?




Example 6 (6 points) Consider these relations on the set of integers:
R1 = {(a, b) | a ≤ b},         R2 = {(a, b) | a > b},           R3 = {(a, b) | a = b or a = -b},
R4 = {(a, b) | a = b},         R5 = {(a, b) | a = b + 1},       R6 = {(a, b) | a + b ≤ 3}.
Which of these relations contain each of the pairs (1, 1), (1, 2), (2, 1), (1,-1), and (2, 2)?




Example 7 (2 points) How many relations are there on a set with n elements?




มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555)                                     เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
Relations - 08                                                                           CSC1001 Discrete Mathematics           3
3. Properties of Relations
  Definition 3

  A relation R on a set A is called reflexive if (a, a) ∈ R for every element a ∈ A.

Example 8 (2 points) Consider the following relations on {1, 2, 3, 4}:
R1 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 4), (4, 1), (4, 4)},
R2 = {(1, 1), (1, 2), (2, 1)},
R3 = {(1, 1), (1, 2), (1, 4), (2, 1), (2, 2), (3, 3), (4, 1), (4, 4)},
R4 = {(2, 1), (3, 1), (3, 2), (4, 1), (4, 2), (4, 3)},
R5 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4)},
R6 = {(3, 4)}.
Which of these relations are reflexive?




Example 9 (2 points) Which of the relations from Example 6 are reflexive?




  Definition 4

  A relation R on a set A is called symmetric if (b, a) ∈ R whenever (a, b) ∈ R, for all a, b ∈ A. A relation R
  on a set A such that for all a, b ∈ A, if (a, b) ∈ R and (b, a) ∈ R, then a = b is called antisymmetric.

Example 10 (2 points) Which of the relations from Example 8 are symmetric and which are antisymmetric?




Example 11 (2 points) Which of the relations from Example 6 are symmetric and which are antisymmetric?




มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555)                                               เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
4          CSC1001 Discrete Mathematics                                                                 08 - Relations


    Definition 5

    A relation R on a set A is called transitive if whenever (a, b) ∈ R and (b, c) ∈ R, then (a, c) ∈ R, for all a,
    b, c ∈ A.

Example 12 (2 points) Which of the relations from Example 8 are transitive?




Example 13 (2 points) Which of the relations from Example 6 are transitive?




4. Combining Relations
     Because relations from A to B are subsets of A × B, two relations from A to B can be combined in any way
two sets can be combined.
Example 13 (8 points) 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)} can be combined to obtain
R1    ∪   R2 =       …………………………………………………………………………………………………………………
R1    ∩   R2 =       …………………………………………………………………………………………………………………
R1 - R2 =            …………………………………………………………………………………………………………………
R2 - R1 =            …………………………………………………………………………………………………………………
Example 14 (8 points) Let A = {-1, 0, 1, 2} and B = {1, 3, 5, 7}. The relations R1 = {(-1, 1), (0, 3), (1, 5) , (2, 7)}
and R2 = {(1, 1), (0, 3), (1, 3), (1, 5), (2, 5)} can be combined to obtain
R1    ∪   R2 =       …………………………………………………………………………………………………………………
R1    ∩   R2 =       …………………………………………………………………………………………………………………
R1 - R2 =            …………………………………………………………………………………………………………………
R2 - R1 =          …………………………………………………………………………………………………………………
Example 15 (2 points) Let R1 and R2 are the relations from Example 14 and given R3 = {(-1, 1), (0, 3), (0, 5),
(1, 5), (2, 7)} find (R1 ∪ R2) ∩ R3
(R1   ∪   R2 )   ∩   R3 =   ………………………………………………………………………………………………………..

มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555)                                     เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
Relations - 08                                                                  CSC1001 Discrete Mathematics                    5
  Definition 6

 Let R be a relation from a set A to a set B and S a relation from B to a set C. The composite of R and S is
 the relation consisting of ordered pairs (a, c), where a ∈ A, c ∈ C, and for which there exists an element
 b ∈ B such that (a, b) ∈ R and (b, c) ∈ S. We denote the composite of R and S by S o R.

Example 16 (2 points) What is the composite of the relations R and S, where R is the relation from {1, 2, 3} to
{1, 2, 3, 4} with R = {(1, 1), (1, 4), (2, 3), (3, 1), (3, 4)} and S is the relation from {1, 2, 3, 4} to {0, 1, 2} with S =
{(1, 0), (2, 0), (3, 1), (3, 2), (4, 1)}?




Example 17 (2 points) Let R be the relation {(1, 2), (1, 3), (2, 3), (2, 4), (3, 1)}, and let S be the relation {(2, 1),
(3, 1), (3, 2), (4, 2)}. Find S o R?




  2       n-ary Relations and Their Applications
1. n-ary Relations
  Definition 1

 Let A1,A2, . . . , An be sets. An n-ary relation on these sets is a subset of A1       ×   A2   ×   …   ×   An. The sets A1,
 A2, … An are called the domains of the relation, and n is called its degree.

Example 18 (2 points) Let R be the relation on N × N × N consisting of triples (a, b, c), where a, b, and c are
integers with a < b < c. Find the degree and its domains? and Show 5 examples of (a, b, c) ∈ R




Example 19 (2 points) Let R be the relation on Z × Z × Z consisting of all triples of integers (a, b, c) in which a,
b, and c form an arithmetic progression. That is, (a, b, c) ∈ R if and only if there is an integer k such that b = a
+ k and c = a + 2k, or equivalently, such that b - a = k and c - b = k. Find the degree and its domains? and
Show 5 examples of (a, b, c) ∈ R
มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555)                                         เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
6       CSC1001 Discrete Mathematics                                                               08 - Relations




Example 20 (2 points) Let R be the relation on Z × Z × Z+ consisting of triples (a, b, m), where a, b, and m are
integers with m ≥ 1 and a ≡ b (mod m). Find the degree and its domains? and Show 5 examples of (a, b, c)
∈R




2. Databases and Relations
    The relational data model, based on the concept of a relation. A database consists of records, which are
n-tuples, made up of fields. The fields are the entries of the n-tuples. Relations used to represent databases
are also called tables. Each column of the table corresponds to an attribute of the database. A domain of an
n-ary relation is called a primary key. That is, a domain is a primary key when no two n-tuples in the relation
have the same value from this domain.
    Combinations of domains can also uniquely identify n-tuples in an relation. When the values of a set of
domains determine an n-tuple in a relation, the Cartesian product of these domains is called a composite key.
Example 21 (2 points) Find a number of records and fields and identify the primary key of the table?




Example 22 (2 points) Is the Cartesian product of the domain of major fields of study and the domain of GPAs
a composite key for the n-ary relation from Table 1, assuming that no n-tuples are ever added?




มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555)                                เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
Relations - 08                                                          CSC1001 Discrete Mathematics            7
3. Operations on n-ary Relations
  Definition 2

 Let R be an n-ary relation and C a condition that elements in R may satisfy. Then the selection operator sC
 maps the n-ary relation R to the n-ary relation of all n-tuples from R that satisfy the condition C.

Example 23 (2 points) Find the records of computer science majors in the n-ary relation R shown in Table 1




Example 24 (2 points) Find the records where GPA greater than 3.50 in the n-ary relation R shown in Table 1




  3        Representing Relations
1. Representing Relations Using Matrices
  Definition 1

 A relation between finite sets can be represented using a zero–one matrix. by the matrix MR = [mij ], where
         ⎧1 if(a i , b i ) ∈ R
  m ij = ⎨
         ⎩0 if(a i , b i ) ∉ R


Example 25 (2 points) Suppose that A = {1, 2, 3} and B = {1, 2}. Let R be the relation from A to B containing
(a, b) if a ∈ A, b ∈ B, and a > b. What is the matrix representing R if a1 = 1, a2 = 2, and a3 = 3, and b1 = 1
and b2 = 2?




Example 26 (2 points) Suppose that A = {0, 2, 4, 6} and B = {1, 2, 3, 4}. Let R be the relation from A to B
containing (a, b) if a ∈ A, b ∈ B, and a ≤ b. What is the matrix representing R?
มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555)                               เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
8         CSC1001 Discrete Mathematics                                                                08 - Relations




Example 27 (2 points) Let A = {a1, a2, a3} and B = {b1, b2, b3, b4, b5}. Which ordered pairs are in the relation R
represented by the matrix?
          ⎡0 1 0 0 0 ⎤
    M R = ⎢1 0 1 1 0 ⎥
          ⎢          ⎥
          ⎢1 0 1 0 1 ⎥
          ⎣          ⎦




Example 28 (2 points) Let A = {0, 4, 8, 12} and B = {1, 3, 5}. Which ordered pairs are in the relation R
represented by the matrix?
         ⎡0        1 1⎤
         ⎢1        0 1⎥
    MR = ⎢            ⎥
         ⎢0        1 1⎥
         ⎢            ⎥
         ⎣1        0 0⎦



    Definition 2

    The relation R is symmetric if (a, b) ∈ R implies that (b, a) ∈ R. In terms of the entries of MR, R is
    symmetric if and only if mji = 1 whenever mij = 1. This also means mji = 0 whenever mij = 0. Consequently,
    R is symmetric if and only if mij = mji. Recalling the definition of the transpose of a matrix from Chapter 3,
    we see that R is symmetric if and only if MR = (MR)t

    Definition 3

    The relation R is antisymmetric if and only if (a, b) ∈ R and (b, a) ∈ R imply that a = b. Consequently, the
    matrix of an antisymmetric relation has the property that if mij = 1 with i ≠ j, then mji = 0. Or, in other
    words, either mij = 0 or mji = 0 when i ≠ j.




มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555)                                   เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
Relations - 08                                                                           CSC1001 Discrete Mathematics           9
Example 29 (2 points) Suppose that the relation R on a set is represented by the matrix. Is R reflexive, sym-
metric, and/or antisymmetric?
        ⎡1 1 0⎤
  M R = ⎢1 1 1⎥
        ⎢      ⎥
        ⎢0 1 1 ⎥
        ⎣      ⎦



Example 30 (2 points) Suppose that the relation R on a set is represented by the matrix. Is R reflexive, sym-
metric, and/or antisymmetric?
        ⎡0 0 0 ⎤
  M R = ⎢0 1 0 ⎥
        ⎢      ⎥
        ⎢0 0 1 ⎥
        ⎣      ⎦




  Definition 4

 The Boolean operations join and meet can be used to find the matrices representing the union and the
 intersection of two relations. Suppose that R1 and R2 are relations on a set A represented by the matrices
 MR1 and MR2, respectively. The matrices representing the union and intersection of these relations are
  M R ∪R = M R ∨ M R and M R ∩R = M R ∧ M R
      1   2            1         2            1   2        1       2




  Definition 5

 Let the zero–one matrices for S o R, R, and S be M SoR = [tij ], MR = [rij ], and MS = [sij ], respectively. The
 ordered pair (ai, cj ) belongs to S o R if and only if there is an element bk such that (ai, bk) belongs to R and
 (bk, cj ) belongs to S. It follows that tij = 1 if and only if rik = skj = 1 for some k. From the definition of the
 Boolean product, this means that M SoR = M R M S

Example 31 (2 points) Suppose that the relations S and R on a set A are represented by the matrices?
     ⎡1       0   0⎤            ⎡1   0   0⎤
     ⎢0       1   1⎥            ⎢1   1   1⎥
S=   ⎢             ⎥       R=   ⎢         ⎥   Find    M S∪ R , M S∩ R   and   M So R ?
     ⎢0       1   1⎥            ⎢1   1   1⎥
     ⎢             ⎥            ⎢         ⎥
     ⎣0       0   1⎦            ⎣1   0   0⎦




มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555)                                               เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี

Weitere ähnliche Inhalte

Was ist angesagt?

CMSC 56 | Lecture 15: Closures of Relations
CMSC 56 | Lecture 15: Closures of RelationsCMSC 56 | Lecture 15: Closures of Relations
CMSC 56 | Lecture 15: Closures of Relationsallyn joy calcaben
 
CMSC 56 | Lecture 16: Equivalence of Relations & Partial Ordering
CMSC 56 | Lecture 16: Equivalence of Relations & Partial OrderingCMSC 56 | Lecture 16: Equivalence of Relations & Partial Ordering
CMSC 56 | Lecture 16: Equivalence of Relations & Partial Orderingallyn joy calcaben
 
CMSC 56 | Lecture 14: Representing Relations
CMSC 56 | Lecture 14: Representing RelationsCMSC 56 | Lecture 14: Representing Relations
CMSC 56 | Lecture 14: Representing Relationsallyn joy calcaben
 
Relations and functions
Relations and functions Relations and functions
Relations and functions Leslie Amoguis
 
BCA_Semester-II-Discrete Mathematics_unit-ii_Relation and ordering
BCA_Semester-II-Discrete Mathematics_unit-ii_Relation and orderingBCA_Semester-II-Discrete Mathematics_unit-ii_Relation and ordering
BCA_Semester-II-Discrete Mathematics_unit-ii_Relation and orderingRai University
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Himanshu Dua
 
Partial-Orderings in Discrete Mathematics
 Partial-Orderings in Discrete Mathematics Partial-Orderings in Discrete Mathematics
Partial-Orderings in Discrete MathematicsMeghaj Mallick
 
Relations & functions
Relations & functionsRelations & functions
Relations & functionsindu thakur
 
Relations and Its Applications
Relations and Its ApplicationsRelations and Its Applications
Relations and Its ApplicationsVedavyas Sheoy
 
Section 9: Equivalence Relations & Cosets
Section 9: Equivalence Relations & CosetsSection 9: Equivalence Relations & Cosets
Section 9: Equivalence Relations & CosetsKevin Johnson
 
Relations and functions
Relations and functions Relations and functions
Relations and functions Seyid Kadher
 
Relation and function
Relation and functionRelation and function
Relation and functionAadityaGera
 

Was ist angesagt? (19)

Relations in Discrete Math
Relations in Discrete MathRelations in Discrete Math
Relations in Discrete Math
 
CMSC 56 | Lecture 15: Closures of Relations
CMSC 56 | Lecture 15: Closures of RelationsCMSC 56 | Lecture 15: Closures of Relations
CMSC 56 | Lecture 15: Closures of Relations
 
CMSC 56 | Lecture 16: Equivalence of Relations & Partial Ordering
CMSC 56 | Lecture 16: Equivalence of Relations & Partial OrderingCMSC 56 | Lecture 16: Equivalence of Relations & Partial Ordering
CMSC 56 | Lecture 16: Equivalence of Relations & Partial Ordering
 
Relations
RelationsRelations
Relations
 
CMSC 56 | Lecture 14: Representing Relations
CMSC 56 | Lecture 14: Representing RelationsCMSC 56 | Lecture 14: Representing Relations
CMSC 56 | Lecture 14: Representing Relations
 
computational_Maths
computational_Mathscomputational_Maths
computational_Maths
 
Relations and functions
Relations and functions Relations and functions
Relations and functions
 
BCA_Semester-II-Discrete Mathematics_unit-ii_Relation and ordering
BCA_Semester-II-Discrete Mathematics_unit-ii_Relation and orderingBCA_Semester-II-Discrete Mathematics_unit-ii_Relation and ordering
BCA_Semester-II-Discrete Mathematics_unit-ii_Relation and ordering
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)
 
Partial-Orderings in Discrete Mathematics
 Partial-Orderings in Discrete Mathematics Partial-Orderings in Discrete Mathematics
Partial-Orderings in Discrete Mathematics
 
Relations & functions
Relations & functionsRelations & functions
Relations & functions
 
Relations and Its Applications
Relations and Its ApplicationsRelations and Its Applications
Relations and Its Applications
 
Section 9: Equivalence Relations & Cosets
Section 9: Equivalence Relations & CosetsSection 9: Equivalence Relations & Cosets
Section 9: Equivalence Relations & Cosets
 
Relations and functions
Relations and functions Relations and functions
Relations and functions
 
Relation and function
Relation and functionRelation and function
Relation and function
 
Relations and Functions 1
Relations and Functions 1Relations and Functions 1
Relations and Functions 1
 
Relations and Functions 2
Relations and Functions 2Relations and Functions 2
Relations and Functions 2
 
Relations
RelationsRelations
Relations
 
Per5 relasi
Per5 relasiPer5 relasi
Per5 relasi
 

Andere mochten auch

Discrete-Chapter 04 Logic Part I
Discrete-Chapter 04 Logic Part IDiscrete-Chapter 04 Logic Part I
Discrete-Chapter 04 Logic Part IWongyos Keardsri
 
Discrete-Chapter 03 Matrices
Discrete-Chapter 03 MatricesDiscrete-Chapter 03 Matrices
Discrete-Chapter 03 MatricesWongyos Keardsri
 
Discrete-Chapter 02 Functions and Sequences
Discrete-Chapter 02 Functions and SequencesDiscrete-Chapter 02 Functions and Sequences
Discrete-Chapter 02 Functions and SequencesWongyos Keardsri
 
Introduction to management
Introduction to managementIntroduction to management
Introduction to managementBilal Amjad
 
Discrete-Chapter 04 Logic Part II
Discrete-Chapter 04 Logic Part IIDiscrete-Chapter 04 Logic Part II
Discrete-Chapter 04 Logic Part IIWongyos Keardsri
 
Discrete-Chapter 07 Probability
Discrete-Chapter 07 ProbabilityDiscrete-Chapter 07 Probability
Discrete-Chapter 07 ProbabilityWongyos Keardsri
 
Discrete-Chapter 09 Algorithms
Discrete-Chapter 09 AlgorithmsDiscrete-Chapter 09 Algorithms
Discrete-Chapter 09 AlgorithmsWongyos Keardsri
 
Discrete-Chapter 06 Counting
Discrete-Chapter 06 CountingDiscrete-Chapter 06 Counting
Discrete-Chapter 06 CountingWongyos Keardsri
 
Tenerife airport disaster klm flight 4805 and pan
Tenerife airport disaster klm flight 4805 and panTenerife airport disaster klm flight 4805 and pan
Tenerife airport disaster klm flight 4805 and panReefear Ajang
 
Discrete-Chapter 05 Inference and Proofs
Discrete-Chapter 05 Inference and ProofsDiscrete-Chapter 05 Inference and Proofs
Discrete-Chapter 05 Inference and ProofsWongyos Keardsri
 
Meaning relations and properties
Meaning relations and propertiesMeaning relations and properties
Meaning relations and propertiesAdriana Rodriguez
 
Chapter 1 Logic of Compound Statements
Chapter 1 Logic of Compound StatementsChapter 1 Logic of Compound Statements
Chapter 1 Logic of Compound Statementsguestd166eb5
 
Discrete Structures. Lecture 1
 Discrete Structures. Lecture 1  Discrete Structures. Lecture 1
Discrete Structures. Lecture 1 Ali Usman
 
Bab 3 Tamadun Melayu Baru
Bab 3  Tamadun Melayu BaruBab 3  Tamadun Melayu Baru
Bab 3 Tamadun Melayu Baruwan arizwnb
 

Andere mochten auch (20)

Discrete-Chapter 04 Logic Part I
Discrete-Chapter 04 Logic Part IDiscrete-Chapter 04 Logic Part I
Discrete-Chapter 04 Logic Part I
 
Discrete-Chapter 03 Matrices
Discrete-Chapter 03 MatricesDiscrete-Chapter 03 Matrices
Discrete-Chapter 03 Matrices
 
Discrete-Chapter 02 Functions and Sequences
Discrete-Chapter 02 Functions and SequencesDiscrete-Chapter 02 Functions and Sequences
Discrete-Chapter 02 Functions and Sequences
 
Introduction to management
Introduction to managementIntroduction to management
Introduction to management
 
Discrete-Chapter 01 Sets
Discrete-Chapter 01 SetsDiscrete-Chapter 01 Sets
Discrete-Chapter 01 Sets
 
Discrete-Chapter 04 Logic Part II
Discrete-Chapter 04 Logic Part IIDiscrete-Chapter 04 Logic Part II
Discrete-Chapter 04 Logic Part II
 
Discrete-Chapter 07 Probability
Discrete-Chapter 07 ProbabilityDiscrete-Chapter 07 Probability
Discrete-Chapter 07 Probability
 
Discrete-Chapter 09 Algorithms
Discrete-Chapter 09 AlgorithmsDiscrete-Chapter 09 Algorithms
Discrete-Chapter 09 Algorithms
 
Discrete-Chapter 06 Counting
Discrete-Chapter 06 CountingDiscrete-Chapter 06 Counting
Discrete-Chapter 06 Counting
 
Tenerife airport disaster klm flight 4805 and pan
Tenerife airport disaster klm flight 4805 and panTenerife airport disaster klm flight 4805 and pan
Tenerife airport disaster klm flight 4805 and pan
 
Discrete-Chapter 05 Inference and Proofs
Discrete-Chapter 05 Inference and ProofsDiscrete-Chapter 05 Inference and Proofs
Discrete-Chapter 05 Inference and Proofs
 
Set Operations
Set OperationsSet Operations
Set Operations
 
Meaning relations and properties
Meaning relations and propertiesMeaning relations and properties
Meaning relations and properties
 
Chapter 1 Logic of Compound Statements
Chapter 1 Logic of Compound StatementsChapter 1 Logic of Compound Statements
Chapter 1 Logic of Compound Statements
 
Set Theory Presentation
Set Theory PresentationSet Theory Presentation
Set Theory Presentation
 
Bab 5
Bab 5Bab 5
Bab 5
 
Discrete Structures. Lecture 1
 Discrete Structures. Lecture 1  Discrete Structures. Lecture 1
Discrete Structures. Lecture 1
 
Bab 3
Bab 3Bab 3
Bab 3
 
Bab 3 Tamadun Melayu Baru
Bab 3  Tamadun Melayu BaruBab 3  Tamadun Melayu Baru
Bab 3 Tamadun Melayu Baru
 
Bab 4
Bab 4Bab 4
Bab 4
 

Ähnlich wie Discrete-Chapter 08 Relations

dm_13_RelationsAndTheirProperties (1).pdf
dm_13_RelationsAndTheirProperties (1).pdfdm_13_RelationsAndTheirProperties (1).pdf
dm_13_RelationsAndTheirProperties (1).pdfSanjanaAdri
 
dm_13_RelationsAndTheirProperties (1).pptx
dm_13_RelationsAndTheirProperties (1).pptxdm_13_RelationsAndTheirProperties (1).pptx
dm_13_RelationsAndTheirProperties (1).pptxRockyIslam5
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Himanshu Dua
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Himanshu Dua
 
Relation in Discrete Mathematics
Relation in Discrete Mathematics Relation in Discrete Mathematics
Relation in Discrete Mathematics NANDINI SHARMA
 
Introduction to The Relations in Mathematics.pptx
Introduction to The Relations in Mathematics.pptxIntroduction to The Relations in Mathematics.pptx
Introduction to The Relations in Mathematics.pptxJadhavShaileshShashi
 
Matematika terapan week 4
Matematika terapan week 4 Matematika terapan week 4
Matematika terapan week 4 nellylawar
 
Relation function
Relation functionRelation function
Relation functionmentorsnet
 
Relation function
Relation functionRelation function
Relation functionBiswa Nayak
 
Matematika terapan minggu ke-4
Matematika terapan minggu ke-4Matematika terapan minggu ke-4
Matematika terapan minggu ke-4Fisma Ananda
 
MATRIX REPRESENTATION OF A RELATION.pptx
MATRIX REPRESENTATION OF A RELATION.pptxMATRIX REPRESENTATION OF A RELATION.pptx
MATRIX REPRESENTATION OF A RELATION.pptxKiran Kumar Malik
 
Toc chapter 1 srg
Toc chapter 1 srgToc chapter 1 srg
Toc chapter 1 srgShayak Giri
 
Query optimization in database
Query optimization in databaseQuery optimization in database
Query optimization in databaseRakesh Kumar
 
Week 5 ( basic concept of relation )
Week 5 ( basic concept of relation )Week 5 ( basic concept of relation )
Week 5 ( basic concept of relation )OliverBaltazar2
 
Relations and Functions #BB2.0.pdf
Relations and Functions #BB2.0.pdfRelations and Functions #BB2.0.pdf
Relations and Functions #BB2.0.pdfAakashKushwaha26
 

Ähnlich wie Discrete-Chapter 08 Relations (20)

dm_13_RelationsAndTheirProperties (1).pdf
dm_13_RelationsAndTheirProperties (1).pdfdm_13_RelationsAndTheirProperties (1).pdf
dm_13_RelationsAndTheirProperties (1).pdf
 
dm_13_RelationsAndTheirProperties (1).pptx
dm_13_RelationsAndTheirProperties (1).pptxdm_13_RelationsAndTheirProperties (1).pptx
dm_13_RelationsAndTheirProperties (1).pptx
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)
 
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)Final relation1 m_tech(cse)
Final relation1 m_tech(cse)
 
Relations
RelationsRelations
Relations
 
Relation in Discrete Mathematics
Relation in Discrete Mathematics Relation in Discrete Mathematics
Relation in Discrete Mathematics
 
Sadat sumon
Sadat sumonSadat sumon
Sadat sumon
 
Relation and function_xii
Relation and function_xiiRelation and function_xii
Relation and function_xii
 
Relations
RelationsRelations
Relations
 
Introduction to The Relations in Mathematics.pptx
Introduction to The Relations in Mathematics.pptxIntroduction to The Relations in Mathematics.pptx
Introduction to The Relations in Mathematics.pptx
 
Matematika terapan week 4
Matematika terapan week 4 Matematika terapan week 4
Matematika terapan week 4
 
Relation function
Relation functionRelation function
Relation function
 
Relation function
Relation functionRelation function
Relation function
 
Lemh101
Lemh101Lemh101
Lemh101
 
Matematika terapan minggu ke-4
Matematika terapan minggu ke-4Matematika terapan minggu ke-4
Matematika terapan minggu ke-4
 
MATRIX REPRESENTATION OF A RELATION.pptx
MATRIX REPRESENTATION OF A RELATION.pptxMATRIX REPRESENTATION OF A RELATION.pptx
MATRIX REPRESENTATION OF A RELATION.pptx
 
Toc chapter 1 srg
Toc chapter 1 srgToc chapter 1 srg
Toc chapter 1 srg
 
Query optimization in database
Query optimization in databaseQuery optimization in database
Query optimization in database
 
Week 5 ( basic concept of relation )
Week 5 ( basic concept of relation )Week 5 ( basic concept of relation )
Week 5 ( basic concept of relation )
 
Relations and Functions #BB2.0.pdf
Relations and Functions #BB2.0.pdfRelations and Functions #BB2.0.pdf
Relations and Functions #BB2.0.pdf
 

Mehr von Wongyos Keardsri

How to Study and Research in Computer-related Master Program
How to Study and Research in Computer-related Master ProgramHow to Study and Research in Computer-related Master Program
How to Study and Research in Computer-related Master ProgramWongyos Keardsri
 
The next generation intelligent transport systems: standards and applications
The next generation intelligent transport systems: standards and applicationsThe next generation intelligent transport systems: standards and applications
The next generation intelligent transport systems: standards and applicationsWongyos Keardsri
 
SysProg-Tutor 03 Unix Shell Script Programming
SysProg-Tutor 03 Unix Shell Script ProgrammingSysProg-Tutor 03 Unix Shell Script Programming
SysProg-Tutor 03 Unix Shell Script ProgrammingWongyos Keardsri
 
SysProg-Tutor 02 Introduction to Unix Operating System
SysProg-Tutor 02 Introduction to Unix Operating SystemSysProg-Tutor 02 Introduction to Unix Operating System
SysProg-Tutor 02 Introduction to Unix Operating SystemWongyos Keardsri
 
SysProg-Tutor 01 Introduction to C Programming Language
SysProg-Tutor 01 Introduction to C Programming LanguageSysProg-Tutor 01 Introduction to C Programming Language
SysProg-Tutor 01 Introduction to C Programming LanguageWongyos Keardsri
 
Discrete-Chapter 11 Graphs Part III
Discrete-Chapter 11 Graphs Part IIIDiscrete-Chapter 11 Graphs Part III
Discrete-Chapter 11 Graphs Part IIIWongyos Keardsri
 
Discrete-Chapter 11 Graphs Part II
Discrete-Chapter 11 Graphs Part IIDiscrete-Chapter 11 Graphs Part II
Discrete-Chapter 11 Graphs Part IIWongyos Keardsri
 
Discrete-Chapter 11 Graphs Part I
Discrete-Chapter 11 Graphs Part IDiscrete-Chapter 11 Graphs Part I
Discrete-Chapter 11 Graphs Part IWongyos Keardsri
 
Discrete-Chapter 12 Modeling Computation
Discrete-Chapter 12 Modeling ComputationDiscrete-Chapter 12 Modeling Computation
Discrete-Chapter 12 Modeling ComputationWongyos Keardsri
 
Java-Chapter 14 Creating Graphics with DWindow
Java-Chapter 14 Creating Graphics with DWindowJava-Chapter 14 Creating Graphics with DWindow
Java-Chapter 14 Creating Graphics with DWindowWongyos Keardsri
 
Java-Chapter 13 Advanced Classes and Objects
Java-Chapter 13 Advanced Classes and ObjectsJava-Chapter 13 Advanced Classes and Objects
Java-Chapter 13 Advanced Classes and ObjectsWongyos Keardsri
 
Java-Chapter 11 Recursions
Java-Chapter 11 RecursionsJava-Chapter 11 Recursions
Java-Chapter 11 RecursionsWongyos Keardsri
 
Java-Chapter 10 Two Dimensional Arrays
Java-Chapter 10 Two Dimensional ArraysJava-Chapter 10 Two Dimensional Arrays
Java-Chapter 10 Two Dimensional ArraysWongyos Keardsri
 
Java-Chapter 09 Advanced Statements and Applications
Java-Chapter 09 Advanced Statements and ApplicationsJava-Chapter 09 Advanced Statements and Applications
Java-Chapter 09 Advanced Statements and ApplicationsWongyos Keardsri
 
Java-Chapter 07 One Dimensional Arrays
Java-Chapter 07 One Dimensional ArraysJava-Chapter 07 One Dimensional Arrays
Java-Chapter 07 One Dimensional ArraysWongyos Keardsri
 
Java-Chapter 06 File Operations
Java-Chapter 06 File OperationsJava-Chapter 06 File Operations
Java-Chapter 06 File OperationsWongyos Keardsri
 
Java-Chapter 05 String Operations
Java-Chapter 05 String OperationsJava-Chapter 05 String Operations
Java-Chapter 05 String OperationsWongyos Keardsri
 

Mehr von Wongyos Keardsri (20)

How to Study and Research in Computer-related Master Program
How to Study and Research in Computer-related Master ProgramHow to Study and Research in Computer-related Master Program
How to Study and Research in Computer-related Master Program
 
The next generation intelligent transport systems: standards and applications
The next generation intelligent transport systems: standards and applicationsThe next generation intelligent transport systems: standards and applications
The next generation intelligent transport systems: standards and applications
 
IP address anonymization
IP address anonymizationIP address anonymization
IP address anonymization
 
SysProg-Tutor 03 Unix Shell Script Programming
SysProg-Tutor 03 Unix Shell Script ProgrammingSysProg-Tutor 03 Unix Shell Script Programming
SysProg-Tutor 03 Unix Shell Script Programming
 
SysProg-Tutor 02 Introduction to Unix Operating System
SysProg-Tutor 02 Introduction to Unix Operating SystemSysProg-Tutor 02 Introduction to Unix Operating System
SysProg-Tutor 02 Introduction to Unix Operating System
 
SysProg-Tutor 01 Introduction to C Programming Language
SysProg-Tutor 01 Introduction to C Programming LanguageSysProg-Tutor 01 Introduction to C Programming Language
SysProg-Tutor 01 Introduction to C Programming Language
 
Discrete-Chapter 11 Graphs Part III
Discrete-Chapter 11 Graphs Part IIIDiscrete-Chapter 11 Graphs Part III
Discrete-Chapter 11 Graphs Part III
 
Discrete-Chapter 11 Graphs Part II
Discrete-Chapter 11 Graphs Part IIDiscrete-Chapter 11 Graphs Part II
Discrete-Chapter 11 Graphs Part II
 
Discrete-Chapter 11 Graphs Part I
Discrete-Chapter 11 Graphs Part IDiscrete-Chapter 11 Graphs Part I
Discrete-Chapter 11 Graphs Part I
 
Discrete-Chapter 10 Trees
Discrete-Chapter 10 TreesDiscrete-Chapter 10 Trees
Discrete-Chapter 10 Trees
 
Discrete-Chapter 12 Modeling Computation
Discrete-Chapter 12 Modeling ComputationDiscrete-Chapter 12 Modeling Computation
Discrete-Chapter 12 Modeling Computation
 
Java-Chapter 14 Creating Graphics with DWindow
Java-Chapter 14 Creating Graphics with DWindowJava-Chapter 14 Creating Graphics with DWindow
Java-Chapter 14 Creating Graphics with DWindow
 
Java-Chapter 13 Advanced Classes and Objects
Java-Chapter 13 Advanced Classes and ObjectsJava-Chapter 13 Advanced Classes and Objects
Java-Chapter 13 Advanced Classes and Objects
 
Java-Chapter 11 Recursions
Java-Chapter 11 RecursionsJava-Chapter 11 Recursions
Java-Chapter 11 Recursions
 
Java-Chapter 10 Two Dimensional Arrays
Java-Chapter 10 Two Dimensional ArraysJava-Chapter 10 Two Dimensional Arrays
Java-Chapter 10 Two Dimensional Arrays
 
Java-Chapter 09 Advanced Statements and Applications
Java-Chapter 09 Advanced Statements and ApplicationsJava-Chapter 09 Advanced Statements and Applications
Java-Chapter 09 Advanced Statements and Applications
 
Java-Chapter 08 Methods
Java-Chapter 08 MethodsJava-Chapter 08 Methods
Java-Chapter 08 Methods
 
Java-Chapter 07 One Dimensional Arrays
Java-Chapter 07 One Dimensional ArraysJava-Chapter 07 One Dimensional Arrays
Java-Chapter 07 One Dimensional Arrays
 
Java-Chapter 06 File Operations
Java-Chapter 06 File OperationsJava-Chapter 06 File Operations
Java-Chapter 06 File Operations
 
Java-Chapter 05 String Operations
Java-Chapter 05 String OperationsJava-Chapter 05 String Operations
Java-Chapter 05 String Operations
 

Discrete-Chapter 08 Relations

  • 1. Relations - 08 CSC1001 Discrete Mathematics 1 CHAPTER ความสัมพันธ์ 8 (Relations) 1 Relations and Their Properties 1. Relation Deffinitions The most direct way to express a relationship between elements of two sets is to use ordered pairs made up of two related elements. Definition 1 Let A and B be sets. A binary relation from A to B is a subset of A × B. Example 1 (2 points) Let A = {0, 1, 2} and B = {a, b}. Then {(0, a), (0, b), (1, a), (2, b)} is a relation from A to B. This means, for instance, that 0 R a, but that 1 not R b. Relations can be represented graphically using arrows to represent ordered pairs. Another way to represent this relation is to use a table. Example 2 (2 points) Let A be the set of cities in the ASEAN, and let B be the set of countries in the ASEAN as follow list; A = { Bangkok, Johor, Manila, Kuala Lumpur, Hanoi, Phuket, Penang, Naypyidaw, Ho Chi Minh, Chiang Mai } B = { Malaysia, Thailand, Philippines, Vietnam, Myanmar } Find the relations from A to B. Example 3 (2 points) Let A = { 0, 1, 4 } is domain of f(x) and B = { -2, -1, 0, 1, 2 } is range of f(x), find the relations from A to B, if given f(x) = x . มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  • 2. 2 CSC1001 Discrete Mathematics 08 - Relations 2. Relations on a Set Definition 2 A relation on a set A is a relation from A to A. In other words, a relation on a set A is a subset of A × A. Example 4 (2 points) Let A be the set {1, 2, 3, 4}. Which ordered pairs are in the relation R = {(a, b) | a divides b} for example 2 divides 4? Example 5 (4 points) From Example 4 draw all relations by using arrows and table to represent ordered pairs? Example 6 (6 points) Consider these relations on the set of integers: R1 = {(a, b) | a ≤ b}, R2 = {(a, b) | a > b}, R3 = {(a, b) | a = b or a = -b}, R4 = {(a, b) | a = b}, R5 = {(a, b) | a = b + 1}, R6 = {(a, b) | a + b ≤ 3}. Which of these relations contain each of the pairs (1, 1), (1, 2), (2, 1), (1,-1), and (2, 2)? Example 7 (2 points) How many relations are there on a set with n elements? มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  • 3. Relations - 08 CSC1001 Discrete Mathematics 3 3. Properties of Relations Definition 3 A relation R on a set A is called reflexive if (a, a) ∈ R for every element a ∈ A. Example 8 (2 points) Consider the following relations on {1, 2, 3, 4}: R1 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 4), (4, 1), (4, 4)}, R2 = {(1, 1), (1, 2), (2, 1)}, R3 = {(1, 1), (1, 2), (1, 4), (2, 1), (2, 2), (3, 3), (4, 1), (4, 4)}, R4 = {(2, 1), (3, 1), (3, 2), (4, 1), (4, 2), (4, 3)}, R5 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4)}, R6 = {(3, 4)}. Which of these relations are reflexive? Example 9 (2 points) Which of the relations from Example 6 are reflexive? Definition 4 A relation R on a set A is called symmetric if (b, a) ∈ R whenever (a, b) ∈ R, for all a, b ∈ A. A relation R on a set A such that for all a, b ∈ A, if (a, b) ∈ R and (b, a) ∈ R, then a = b is called antisymmetric. Example 10 (2 points) Which of the relations from Example 8 are symmetric and which are antisymmetric? Example 11 (2 points) Which of the relations from Example 6 are symmetric and which are antisymmetric? มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  • 4. 4 CSC1001 Discrete Mathematics 08 - Relations Definition 5 A relation R on a set A is called transitive if whenever (a, b) ∈ R and (b, c) ∈ R, then (a, c) ∈ R, for all a, b, c ∈ A. Example 12 (2 points) Which of the relations from Example 8 are transitive? Example 13 (2 points) Which of the relations from Example 6 are transitive? 4. Combining Relations Because relations from A to B are subsets of A × B, two relations from A to B can be combined in any way two sets can be combined. Example 13 (8 points) 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)} can be combined to obtain R1 ∪ R2 = ………………………………………………………………………………………………………………… R1 ∩ R2 = ………………………………………………………………………………………………………………… R1 - R2 = ………………………………………………………………………………………………………………… R2 - R1 = ………………………………………………………………………………………………………………… Example 14 (8 points) Let A = {-1, 0, 1, 2} and B = {1, 3, 5, 7}. The relations R1 = {(-1, 1), (0, 3), (1, 5) , (2, 7)} and R2 = {(1, 1), (0, 3), (1, 3), (1, 5), (2, 5)} can be combined to obtain R1 ∪ R2 = ………………………………………………………………………………………………………………… R1 ∩ R2 = ………………………………………………………………………………………………………………… R1 - R2 = ………………………………………………………………………………………………………………… R2 - R1 = ………………………………………………………………………………………………………………… Example 15 (2 points) Let R1 and R2 are the relations from Example 14 and given R3 = {(-1, 1), (0, 3), (0, 5), (1, 5), (2, 7)} find (R1 ∪ R2) ∩ R3 (R1 ∪ R2 ) ∩ R3 = ……………………………………………………………………………………………………….. มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  • 5. Relations - 08 CSC1001 Discrete Mathematics 5 Definition 6 Let R be a relation from a set A to a set B and S a relation from B to a set C. The composite of R and S is the relation consisting of ordered pairs (a, c), where a ∈ A, c ∈ C, and for which there exists an element b ∈ B such that (a, b) ∈ R and (b, c) ∈ S. We denote the composite of R and S by S o R. Example 16 (2 points) What is the composite of the relations R and S, where R is the relation from {1, 2, 3} to {1, 2, 3, 4} with R = {(1, 1), (1, 4), (2, 3), (3, 1), (3, 4)} and S is the relation from {1, 2, 3, 4} to {0, 1, 2} with S = {(1, 0), (2, 0), (3, 1), (3, 2), (4, 1)}? Example 17 (2 points) Let R be the relation {(1, 2), (1, 3), (2, 3), (2, 4), (3, 1)}, and let S be the relation {(2, 1), (3, 1), (3, 2), (4, 2)}. Find S o R? 2 n-ary Relations and Their Applications 1. n-ary Relations Definition 1 Let A1,A2, . . . , An be sets. An n-ary relation on these sets is a subset of A1 × A2 × … × An. The sets A1, A2, … An are called the domains of the relation, and n is called its degree. Example 18 (2 points) Let R be the relation on N × N × N consisting of triples (a, b, c), where a, b, and c are integers with a < b < c. Find the degree and its domains? and Show 5 examples of (a, b, c) ∈ R Example 19 (2 points) Let R be the relation on Z × Z × Z consisting of all triples of integers (a, b, c) in which a, b, and c form an arithmetic progression. That is, (a, b, c) ∈ R if and only if there is an integer k such that b = a + k and c = a + 2k, or equivalently, such that b - a = k and c - b = k. Find the degree and its domains? and Show 5 examples of (a, b, c) ∈ R มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  • 6. 6 CSC1001 Discrete Mathematics 08 - Relations Example 20 (2 points) Let R be the relation on Z × Z × Z+ consisting of triples (a, b, m), where a, b, and m are integers with m ≥ 1 and a ≡ b (mod m). Find the degree and its domains? and Show 5 examples of (a, b, c) ∈R 2. Databases and Relations The relational data model, based on the concept of a relation. A database consists of records, which are n-tuples, made up of fields. The fields are the entries of the n-tuples. Relations used to represent databases are also called tables. Each column of the table corresponds to an attribute of the database. A domain of an n-ary relation is called a primary key. That is, a domain is a primary key when no two n-tuples in the relation have the same value from this domain. Combinations of domains can also uniquely identify n-tuples in an relation. When the values of a set of domains determine an n-tuple in a relation, the Cartesian product of these domains is called a composite key. Example 21 (2 points) Find a number of records and fields and identify the primary key of the table? Example 22 (2 points) Is the Cartesian product of the domain of major fields of study and the domain of GPAs a composite key for the n-ary relation from Table 1, assuming that no n-tuples are ever added? มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  • 7. Relations - 08 CSC1001 Discrete Mathematics 7 3. Operations on n-ary Relations Definition 2 Let R be an n-ary relation and C a condition that elements in R may satisfy. Then the selection operator sC maps the n-ary relation R to the n-ary relation of all n-tuples from R that satisfy the condition C. Example 23 (2 points) Find the records of computer science majors in the n-ary relation R shown in Table 1 Example 24 (2 points) Find the records where GPA greater than 3.50 in the n-ary relation R shown in Table 1 3 Representing Relations 1. Representing Relations Using Matrices Definition 1 A relation between finite sets can be represented using a zero–one matrix. by the matrix MR = [mij ], where ⎧1 if(a i , b i ) ∈ R m ij = ⎨ ⎩0 if(a i , b i ) ∉ R Example 25 (2 points) Suppose that A = {1, 2, 3} and B = {1, 2}. Let R be the relation from A to B containing (a, b) if a ∈ A, b ∈ B, and a > b. What is the matrix representing R if a1 = 1, a2 = 2, and a3 = 3, and b1 = 1 and b2 = 2? Example 26 (2 points) Suppose that A = {0, 2, 4, 6} and B = {1, 2, 3, 4}. Let R be the relation from A to B containing (a, b) if a ∈ A, b ∈ B, and a ≤ b. What is the matrix representing R? มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  • 8. 8 CSC1001 Discrete Mathematics 08 - Relations Example 27 (2 points) Let A = {a1, a2, a3} and B = {b1, b2, b3, b4, b5}. Which ordered pairs are in the relation R represented by the matrix? ⎡0 1 0 0 0 ⎤ M R = ⎢1 0 1 1 0 ⎥ ⎢ ⎥ ⎢1 0 1 0 1 ⎥ ⎣ ⎦ Example 28 (2 points) Let A = {0, 4, 8, 12} and B = {1, 3, 5}. Which ordered pairs are in the relation R represented by the matrix? ⎡0 1 1⎤ ⎢1 0 1⎥ MR = ⎢ ⎥ ⎢0 1 1⎥ ⎢ ⎥ ⎣1 0 0⎦ Definition 2 The relation R is symmetric if (a, b) ∈ R implies that (b, a) ∈ R. In terms of the entries of MR, R is symmetric if and only if mji = 1 whenever mij = 1. This also means mji = 0 whenever mij = 0. Consequently, R is symmetric if and only if mij = mji. Recalling the definition of the transpose of a matrix from Chapter 3, we see that R is symmetric if and only if MR = (MR)t Definition 3 The relation R is antisymmetric if and only if (a, b) ∈ R and (b, a) ∈ R imply that a = b. Consequently, the matrix of an antisymmetric relation has the property that if mij = 1 with i ≠ j, then mji = 0. Or, in other words, either mij = 0 or mji = 0 when i ≠ j. มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  • 9. Relations - 08 CSC1001 Discrete Mathematics 9 Example 29 (2 points) Suppose that the relation R on a set is represented by the matrix. Is R reflexive, sym- metric, and/or antisymmetric? ⎡1 1 0⎤ M R = ⎢1 1 1⎥ ⎢ ⎥ ⎢0 1 1 ⎥ ⎣ ⎦ Example 30 (2 points) Suppose that the relation R on a set is represented by the matrix. Is R reflexive, sym- metric, and/or antisymmetric? ⎡0 0 0 ⎤ M R = ⎢0 1 0 ⎥ ⎢ ⎥ ⎢0 0 1 ⎥ ⎣ ⎦ Definition 4 The Boolean operations join and meet can be used to find the matrices representing the union and the intersection of two relations. Suppose that R1 and R2 are relations on a set A represented by the matrices MR1 and MR2, respectively. The matrices representing the union and intersection of these relations are M R ∪R = M R ∨ M R and M R ∩R = M R ∧ M R 1 2 1 2 1 2 1 2 Definition 5 Let the zero–one matrices for S o R, R, and S be M SoR = [tij ], MR = [rij ], and MS = [sij ], respectively. The ordered pair (ai, cj ) belongs to S o R if and only if there is an element bk such that (ai, bk) belongs to R and (bk, cj ) belongs to S. It follows that tij = 1 if and only if rik = skj = 1 for some k. From the definition of the Boolean product, this means that M SoR = M R M S Example 31 (2 points) Suppose that the relations S and R on a set A are represented by the matrices? ⎡1 0 0⎤ ⎡1 0 0⎤ ⎢0 1 1⎥ ⎢1 1 1⎥ S= ⎢ ⎥ R= ⎢ ⎥ Find M S∪ R , M S∩ R and M So R ? ⎢0 1 1⎥ ⎢1 1 1⎥ ⎢ ⎥ ⎢ ⎥ ⎣0 0 1⎦ ⎣1 0 0⎦ มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี