Presentation is loading. Please wait.

Presentation is loading. Please wait.

Relations and Digraphs

Similar presentations


Presentation on theme: "Relations and Digraphs"— Presentation transcript:

1 Relations and Digraphs

2 Product Sets Ordered pair: An ordered pair (a,b) is a listing of the objects a and b in a prescribed order, with a appearing first and b appearing second. Note: The ordered pairs (a1, b1) and (a2, b2) are equal if and only if a1 = a2 and b1 = b2 Product Set (Cartesian product): If A and B are two non empty sets, we define the product set A x B as the set of all ordered pairs(a,b) with a Є A and bЄ B. Thus A x B = { (a, b) I a Є A and bЄ B }.

3 Example1. If A = {1,2,3} and B = {3,4,5,6} then
A x B = {(1,3), (1,4), (1,5), (1,6), (2,3), (2,4),(2,5), (2,6), (3,3), (3,4), (3,5), (3,6)} And B x A = {(3,1), (3,2), (3,3), (4,1), (4,2), (4,3),(5,1), (5,2), (5,3), (6,1), (6,2), (6,3)} Here (1,3) Є A x B whereas (1,3) B x A. Hence A x B ≠ B x A.

4 Partitions: A set {A, B, C, ……
Partitions: A set {A, B, C, …….} of non empty subsets of a set S is called the partition of S if (i) A ∪ B ∪ C ∪ …… = S, (ii) the intersection of every pair of distinct subsets is the empty set, where the subsets A, B, C , … are called its members (elements). Example 2. Consider the subsets A = { 3, 6, 9, … , 24} B = { 1, 4, 7, … , 25} C = { 2, 5, 8, … , 23} of S = { 1, 2, 3, … , 25}

5 Obviously, A ∪ B ∪ C = S and A ∩ B = A ∩ C = B ∩ C = ∅, so that { A, B, C } is a partition of S. Computer representation of sets Characteristic function : Suppose that A be a subset of the universal set U = {u1, u2, … , un}. The characteristic function of A is defined as a function from U to {0, 1} i.e. , fA: U → {0, 1} , by the rule The characteristic function is used in representing sets in computer

6 Example3. If U = { 1, 2, … , 10}, A = {3, 4}, B = { 4, 6, 8} and C = { 6, 8, 10} then
Thus, fA corresponds to sequence 0, 0, 1, 1, 0, 0, 0, 0, 0, 0. Likewise fB corresponds to sequence 0, 0, 0, 1, 0, 1, 0, 1, 0, and fC corresponds to sequence 0, 0, 0, 0, 0, 1, 0, 1, 0, 1.

7 Relation A relation is a set of ordered pairs. Let A and B be two sets. A relation A to B is a subset of A x B Symbolically, R is a relation from A to B iff R ⊆ A x B. If (x, y) be a member of a relation set R, we express it by writing x R y and say “x is in the relation R to y”. Thus (x, y) Є R ⇔ x R y.

8 Example 4. If A ={ 2, 3, 5, 6} and R:A→A and R means “divide” then 2R2, 2R6, 3R3, 3R6,5R5, 6R6 and as such relation set R = { (2,2), (2,6), (3,3), (3,6), (5,5), (6,6)}. Domain and Range: Let R be a relation from A to B. Then the set of all first coordinates of the ordered pairs in relation set R is called the domain of R and the set of all second members of ordered pair in R is called the range of R. Thus, Domain R = {x∣ (x,y) Є R} and Range = {y∣ (x,y) Є R}

9 Example 5. If A = {1,2,3,4} ; B = {3,4,5} and a relation R is defined from A to B by x R y ⇔ x< y, then find Domain and Range of R. Example 6. Determine the domain and range of the given function: The domain is all the values that x is allowed to take on. The only problem we have with this function is that we need to be careful not to divide by zero. So the only values that x can not take on are those which would cause division by zero. So we'll set the denominator equal to zero and solve; our domain will be everything else.

10 x2 – x – 2 = 0 (x – 2)(x + 1) = 0 x = 2   or  x = –1
Then the domain is "all x not equal to –1 or 2“. As we can see from this picture, the graph "covers" all y-values (that is, the graph will go as low as we like, and will also go as high as we like). Since the graph will eventually cover all possible values of y, then the range is "all real numbers".

11 Example 7.Determine the domain and range of the given function:
The domain is all values that x can take on. The only problem we have with this function is that we cannot have a negative inside the square root. So we'll set the insides greater-than-or-equal-to zero, and solve. The result will be our domain: –2x + 3 > 0 –2x > –3 2x < 3 x < 3/2 = 1.5 Then the domain is "all x < 3/2".

12 The graph starts at y = 0 and goes down from there
The graph starts at y = 0 and goes down from there. While the graph goes down very slowly, we know that, eventually, we can go as low as we like (by picking an x that is sufficiently big). Also, we know that the graph will never start coming back up. Then the range is "y < 0". The range requires a graph.:

13 Example 8. Let A = R. Consider the following relation R on A : a R b if and only if 2a + 3b = 6. Find Dom(R) and Ran(R). Example 9. Let A = R. Consider the following relation R on A : a R b if and only if a2 + b2 = 25 Find Dom(R) and Ran(R).

14 R-RELATIVE SET OF AN ELEMENT X
If R is a relation from A to B and xЄA, we define R{x}, the R-Relative set of x, to be the set of all y in B with the property that x is R-related to y. Thus in symbols, R(x) = {y Є B ∣ x R y}. Similarly, if A1 ⊆ A, then R(A1), the relative set of A1, is the set of all y in B with the property that x is R-related to y for some x in A1. That is, R(A1) = {y Є B ∣ x R y for some x in A1 }

15 Example 10. Let A = (a, b, c, d) and let R = { (a, a), (a, b), (b, c), (c, a), (d, c), (c, b) }. Then find R(a), R(b). And if A1 = {c, d}, then find R(A1). Example 11. Let A = R (set of all real numbers). We define the following relation R on A. xRy iff x and y satisfy the equation Find R(x) and R(1).

16 The Matrix of a Relation
Let element of sets A and B be defined as A = {a1, a2, …, am} and B = { b1, b2, … , bm}. Suppose R be a relation from A to B. Then the relation R can be represented by an m x n matrix MR=[mij]m x n , where The matrix MR is known as the matrix of relation R or adjacency matrix or Boolean Matrix.

17 The Matrix of a Relation
Example 12: Let X = {1, 2, 3}, Y = {1, 2} and R = {(2, 1), (3, 1), (3, 2)} then find MR. Solution: Example 13. Find the relation R, when Be a matrix of the relation R from X = {a, b, c} and Y = { d, e, f, g, h}.

18 Matrix transposition Given a matrix M, the transposition of M, denoted Mt, is the matrix obtained by switching the columns and rows of M In a “square” matrix, the main diagonal stays unchanged

19 Matrix join A join of two matrices performs a Boolean OR on each relative entry of the matrices Matrices must be the same size Denoted by the or symbol: 

20 Matrix meet A meet of two matrices performs a Boolean AND on each relative entry of the matrices Matrices must be the same size Denoted by the or symbol: 

21 Matrix Boolean product
A Boolean product of two matrices is similar to matrix multiplication Instead of the sum of the products, it’s the conjunction (and) of the disjunctions (ors) Denoted by the or symbol: 

22 Representing Relations Using Digraphs
If R be a relation on a finite set R then R can be represented pictorially. In this representation each element of the set is represented by a point and each ordered pair (a, b) is represented by an arc (or edge) directed from a to b. Such representations are called digraph or directed graphs. Note: An edge of the form (a, a) is represented using an arc from the vertex a back to itself. Such an edge is called Loop.

23 In-degree of a vertex: If R be a relation on a set A and v Є A then in-degree of v is the number of edges directed towards v. Out-degree of a vertex: If R be a relation on a set A and v Є A then out-degree of v is the number of edges beginning from v i.e., going away from v.

24 Kinds of Relations Reflexive Relation: A relation R on a non-void set A is known as reflexive relation if each member of A is R-related to itself, i.e., x R x, ∀ x Є A. Eg: Let A be the set of all straight lines in a plane. The relation R in A defined by “x parallel to y” is reflexive, since every straight line is parallel to itself. Ir-reflexive: A relation R on a set A is irreflexive if (x, x) ∉ R.

25 Reflexivity Consider a reflexive relation: ≤
One which every element is related to itself Let A = { 1, 2, 3, 4, 5 } If the center (main) diagonal is all 1’s, a relation is reflexive

26 Reflexivity Consider a reflexive relation: ≤
One which every element is related to itself Let A = { 1, 2, 3, 4, 5 } 1 2 5 3 4 If every node has a loop, a relation is reflexive

27 Irreflexivity Consider a irreflexive relation: <
One which every element is not related to itself Let A = { 1, 2, 3, 4, 5 } If the center (main) diagonal is all 0’s, a relation is irreflexive

28 Irreflexivity Consider a irreflexive relation: <
One which every element is not related to itself Let A = { 1, 2, 3, 4, 5 } 1 2 5 3 4 If every node does not have a loop, a relation is irreflexive

29 Symmetric Relation: A relation R on a non-void set A is known as symmetric relation if x R y ⇒ y R x, i.e. whenever (x, y) Є R then (y, x) Є R. Eg: Let A be the set of all straight lines in a plane. The relation R defined by “a is perpendicular to b” is symmetric relation because a ⊥ b ⇒ b ⊥ a; a, b Є A. Asymmetric Relation: A relation R on a non-void set A is known as asymmetric relation if (a, b) Є R ⇒ (b, a) ∉ R; a, b Є A.

30 Symmetry Consider an symmetric relation R
One which if a is related to b then b is related to a for all (a,b) Let A = { 1, 2, 3, 4, 5 } If, for every value, it is the equal to the value in its transposed position, i.e. MR = (MR)T then the relation is symmetric

31 Symmetry Consider an symmetric relation R
One which if a is related to b then b is related to a for all (a,b) Let A = { 1, 2, 3, 4, 5 } If, for every edge, there is an edge in the other direction, then the relation is symmetric Loops are allowed, and do not need edges in the “other” direction 1 2 5 3 4 Called anti- parallel pairs Note that this relation is neither reflexive nor irreflexive!

32 Asymmetry Consider an asymmetric relation: <
One which if a is related to b then b is not related to a for all (a,b) Let A = { 1, 2, 3, 4, 5 } If, for every value and the value in its transposed position, if they are not both 1, then the relation is asymmetric An asymmetric relation must also be irreflexive Thus, the main diagonal must be all 0’s

33 Asymmetry Consider an asymmetric relation: <
One which if a is related to b then b is not related to a for all (a,b) Let A = { 1, 2, 3, 4, 5 } A digraph is asymmetric if: If, for every edge, there is not an edge in the other direction, then the relation is asymmetric Loops are not allowed in an asymmetric digraph (recall it must be irreflexive) 1 2 5 3 4

34 Transitive Relation A relation on a set A is said to be transitive relation if for x, y, z Є A, x R y and y R z ⇒ x R z Eg: The relation “>” defined on the set of natural number N is transitive.

35 Transitivity Consider an transitive relation: ≤
One which if a is related to b and b is related to c then a is related to c for all (a,b), (b,c) and (a,c) Let A = { 1, 2, 3, 4, 5 } If, for every spot (a,b) and (b,c) that each have a 1, there is a 1 at (a,c), then the relation is transitive . i.e. (MR)2 = MR

36 Transitivity Consider an transitive relation: ≤
One which if a is related to b and b is related to c then a is related to c for all (a,b), (b,c) and (a,c) Let A = { 1, 2, 3, 4, 5 } A digraph is transitive if, for there is a edge from a to c when there is a edge from a to b and from b to c 1 2 5 3 4

37 Anti Symmetric Relation
A relation R on a set A is said to be antisymmetric if whenever x ≠ y , then either “x is not related to y” or “y is not related to x” OR A relation R on a set A is said to be antisymmetric if x R y and y R x ⇒ x = y ; x, y Є A,

38 Antisymmetry Consider an antisymmetric relation: ≤
One which if a is related to b then b is not related to a unless a=b for all (a,b) Let A = { 1, 2, 3, 4, 5 } If, for every value and the value in its transposed position, if they are not both 1, then the relation is antisymmetric The center diagonal can have both 1’s and 0’s

39 Antisymmetry Consider an antisymmetric relation: ≤
One which if a is related to b then b is not related to a unless a=b for all (a,b) Let A = { 1, 2, 3, 4, 5 } If, for every edge, there is not an edge in the other direction, then the relation is antisymmetric Loops are allowed in the digraph 1 2 5 3 4

40 Combining relations: via Boolean operators
Let: Join: Meet:

41 Combining relations: via relation composition
Let: d e f g h i a b c d e f g h i a b c

42 Equivalence Relation A relation R in a set is said to be an equivalence relation if (i) R is reflexive i.e., x R x, ∀ x Є R, (ii) R is symmetric i.e., x R y ⇒ y R x; x, y Є R, and (iii) R is transitive i.e., x R y and y R z ⇒ x R z; x, y, z Є R.

43 Eg 1. : If I be the set of integers and if R be defined over I by “a R b” iff “a-b is an even integer” , a, bЄ I, then show that the relation R is an equivalence relation. Eg 2: Show that in the set of integers I = {…, -2, -1, 0, 1, 2, …}, the relation a R b ⇒ a is congruent to b(mod n), n Є N, meaning there by that is an equivalence relation.

44 Eg 3.: Determine whether the relation R on a set A is reflexive, irreflexive, symmetric, asymmetric, antisymmetric or transitive. a) A set of all positive integers, a R b iff ∣a-b∣≤2 b) A set of all positive integers, a R b iff GCD (a, b) = 1. In this case, we say that a and b are relatively prime. c) A = Z; a R b iff a ≤ b + 1. Eg 4: Consider a set A = { a, b, c, d, e, f} and a relation R defined on A given by R = { (a. a), (a, b), (b, a) (b, b), (c, c), (d, d), (d, e), (d, f), (e, d), (e, e), (e, f), (f, d), (f, e), (f, f) }. Write the matrix representation MR of the relation and hence prove that it is an equivalence relation by matrix method.

45 Equivalence classes If X be a set, R be an equivalence relation on X and x Є X, then the set of all those members y Є X, for which x R y, is called equivalence class of x and is denoted by [ x] = { y ∣ x, y Є X, x R y} ; y Є [ x] ⇔ x R y. Quotient set: The set of all equivalence classes of R , form a partition of A, it is denoted by A/R.

46 Eg.5. Let A = { 1, 2, 3, 4} and let R = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 4), (4, 3), (3, 3), (4, 4)}. Verify that R is an equivalence relation. Determine A/R. Q6. Let S = {1, 2, 3, 4} and let A = S x S. Define the following relation R on A : (a, b) R (a’, b’) iff a + b = a’ + b’ i) show that R is an equivalence relation. ii) Compute A/R.

47 Connectivity Relation
Let R be a relation on a set A. A path of length n in R from a to b is a finite sequence π : a, x1, x2, …, xn-1 R b. A path of length ‘n’ involves (n + 1) elements of the set A, although they are not necessarily distinct. Cycle: A path that begins and ends at the same vertex is called a cycle. Rn: If n is a fixed positive integer, then x Rn y means that there is a path of length n from x to y in R. R∞: we define relation R∞ on A, by letting x R∞ y means that there is some path from x to y. R∞ = R U R2 U R3 U…U Rn

48 Eg: Let A = { a, b, c, d, e } and R = { (a, a), (a, b), (b, c), (c, e), (c, d), (d, e) }. Draw digraph of R. Compute: a) R2, b) R∞

49 Partially Ordered Sets
A relation R on a set A is called a partial order if R is reflexive, Antisymmetric, and transitive. A set A together with partial order R is called partially ordered set or simply a poset and will denote it by ( A, R). Eg: Let A be a collection of subsets of a set S. The relation ⊆ of set inclusion is a partial order on A, so (A, ⊆ ) is a poset.

50 Hasse Diagram A partial ordering ≤ on a set P can be represented by means of a diagram known as a Hasse Diagram. In the digraph , we go through the following in order to make it simple. (i) Delete all loops from the vertices since in partial order relation loop at every vertex is obvious. (ii) Delete all edges that must be present because of the transitivity. (iii) Draw the digraph of all partial order with all edges pointing upward in order to remove arrows from the edges. (iv) Denote vertices by dots in place of circles.

51 Eg: Draw the general diagram and hasse diagram of the poset (A, R), where A = { a, b, c} and R = { (a, a), (b, b), (c, c), (a, b), (b, c), (a, c)}

52 a is the greatest element of (S, ≼) if b≼a for all bS…
Let (S, ≼) be a poset. a is maximal in (S, ≼) if there is no bS such that a≼b. (top of the Hasse diagram) a is minimal in (S, ≼) if there is no bS such that b≼a. (bottom of the Hasse diagram) a is the greatest element of (S, ≼) if b≼a for all bS… it has to be unique a is the least element of (S, ≼) if a≼b for all bS. It has to be unique

53 Let A be a subset of (S, ≼). If uS such that a≼u for all aA, then u is called an upper bound of A. If lS such that l≼a for all aA, then l is called an lower bound of A. If x is an upper bound of A and x≼z whenever z is an upper bound of A, then x is called the least upper bound of A…unique If y is a lower bound of A and z≼y whenever z is a lower bound of A, then y is called the greatest lower bound of A…unique

54 CSE 2813 Discrete Structures
Example h j g f d e b c a Maximal: h,j Minimal: a Greatest element: None Least element: a Upper bound of {a,b,c}: e,f,j,h Least upper bound of {a,b,c}: e Lower bound of {a,b,c}: a Greatest lower bound of {a,b,c}: a CSE 2813 Discrete Structures

55 Partially Ordered Sets
Hasse Diagram Consider the poset (S,≤), where S = {2, 4, 5, 10, 15, 20} and the partial order ≤ is the divisibility relation In this poset, there is no element b ∈ S such that b  5 and b divides 5. (That is, 5 is not divisible by any other element of S except 5). Hence, 5 is a minimal element. Similarly, 2 is a minimal element

56 Partially Ordered Sets
Hasse Diagram 10 is not a minimal element because 2 ∈ S and 2 divides 10. That is, there exists an element b ∈ S such that b < 10. Similarly, 4, 15, and 20 are not minimal elements 2 and 5 are the only minimal elements of this poset. Notice that 2 does not divide 5. Therefore, it is not true that 2 ≤ b, for all b ∈ S, and so 2 is not a least element in (S,≤). Similarly, 5 is not a least element. This poset has no least element

57 Partially Ordered Sets
Hasse Diagram There is no element b ∈ S such that b 15, b > 15, and 15 divides b. That is, there is no element b ∈ S such that 15 < b. Thus, 15 is a maximal element. Similarly, 20 is a maximal element. 10 is not a maximal element because 20 ∈ S and 10 divides 20. That is, there exists an element b ∈ S such that 10 < b. Similarly, 4 is not a maximal element.

58 Partially Ordered Sets
Hasse Diagram 20 and 15 are the only maximal elements of this poset 10 does not divide 15, hence it is not true that b ≤ 15, for all b ∈ S, and so 15 is not a greatest element in (S,≤) This poset has no greatest element

59 Eg: Let X = { 1, 3, 5, 7, 15, 21, 35, 105} and R be the relation “/” (divides) on the set X then X is the poset. Determine the following (i) LUB of 3 and 7 (ii) GLB of 15 and 35 (iii) Greatest and least element of X.

60 Partially Ordered Sets

61 Partially Ordered Sets


Download ppt "Relations and Digraphs"

Similar presentations


Ads by Google