Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dr. Ameria Eldosoky Discrete mathematics

Similar presentations


Presentation on theme: "Dr. Ameria Eldosoky Discrete mathematics"— Presentation transcript:

1 Dr. Ameria Eldosoky Discrete mathematics

2 Relations and functions

3 Relations Relation Let A and B be nonempty sets. A relation R from A to B is a subset of A × B. If R ⊆ A× B and (a, b) ∈ R, we say that a is related to b by R, write a R b, if a is not related to b by R, we write a b. If A and B are equal. We say that If R ⊆ A× A is a related on A, instead of a relation from A to A.

4 Relations Example 1 Let A ={1, 2, 3} and B={r, s}. Then we define R={(1, r), (2, s), (3, r)} is a relation from A to B. Example 2 Let A and B be sets of real numbers. We define the following relation R(equals) from A to B Y O X

5 Example 3 Example 4 Relations
Let A={1, 2, 3, 4}. Define the following relation R (less than) on A a R b if and only if a<b Then R= { (1,2) (1,3) (1,4) (2, 3) (2,4) (3,4) } Example 4 Let A=Z+, the set of all positive integers. Define the following relation R on A: a R b if and only if a divides b Then 4 R 12, 6 R 30, but

6 Relations Example 5 Let A be the set of all people in the world. We define the following relation R on A: a R b if any only if there is a sequence a0, a1, a2, …,an of people such that a0=a, an=b and ai-1 knows ai, i=1,2,…,n (n will depend on a and b)

7 Relations Example 6 Let A=R, the set of real numbers. We define the following relation R on A x R y if and only if x and y satisfy the equation x2/4+y2/9=1 O X Y (0,3) (2,0)

8 Sets arising from relations
Let R ⊆ A× B be a relation from A to B. a) The domain of R Denoted by Dom(R), is the set of all first elements in the pairs that make up R. (Dom(R) ⊆ A ) b) The range of R Denoted by Ran(R), is the set of all second elements in the pairs that make up R. (Ran(R) ⊆ B )

9 R-relative set of x Relations
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. R(x) = {y ∈ B | x R y} If A1 ⊆A, then R(A1), the R-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. R(A1) = {y ∈ B | x R y for some x in A1}

10 Relations Example 13 Let A={a, b, c, d} and let R={(a,a), (a,b), (b,c), (c,a), (d,c), (c,b)}. Then R(a) = {a, b} R(b)={c} If A1={c, d}, Then R(A1)= {a, b, c}

11 Relations Theorem 1 Let R be a relation from A to B, and let A1 and A2 be subsets of A, then (a) If A1 ⊆ A2, then R(A1) ⊆ R(A2) (b) R(A1 U A2 ) = R(A1) U R(A2) (c) R (A1 ∩ A2 ) ⊆ R(A1 ) ∩ R(A2)

12 (a) If A1 ⊆ A2, then R(A1) ⊆ R(A2) Proof:
Relations (a) If A1 ⊆ A2, then R(A1) ⊆ R(A2) Proof: If y ∈ R(A1), then x R y for some x in A1, since A1 ⊆ A2, x ∈A2, thus y ∈ R(A2) and therefore R(A1) ⊆ R(A2)

13 (b) R(A1 U A2 ) = R(A1) U R(A2) Relations Proof :
If y ∈ R(A1 U A2 ), then x R y for some x in A1 U A2, then x in A1 or A2. If x in A1 , y ∈ R(A1); if x in A2 . y ∈ R(A2). In either cases, y ∈ R(A1) U R(A2) , therefore R(A1 U A2 ) ⊆ R(A1) U R(A2) (2) R(A1) U R(A2) ⊆ R(A1 U A2 ) A1 ⊆ A1 U A2 , then R(A1) ⊆ R(A1 U A2 ) A2 ⊆ A1 U A2 , then R(A2) ⊆ R(A1 U A2 ) Thus R(A1) U R(A2) ⊆ R(A1 U A2 ) Therefore, we obtain R(A1 U A2 ) = R(A1) U R(A2)

14 Note: R(A1) ∩ R(A2) ⊆ R (A1 ∩ A2)
Relations (c) R (A1 ∩ A2) ⊆ R(A1) ∩ R(A2) Proof: If y ∈ R (A1 ∩ A2 ) , then x R y for some x in A1 ∩ A2, since x is in both A1 and A2 , it follows that y is in both R(A1) and R(A2) ; that is, y ∈ R(A1 ) ∩ R(A2). Therefore R (A1 ∩ A2) ⊆ R(A1) ∩ R(A2) Note: R(A1) ∩ R(A2) ⊆ R (A1 ∩ A2)

15 Relations Theorem 2 Let R and S be relations from A to B, If R(a) =S(a) for all a in A, then R=S Proof: If a R b, then b ∈ R(a). Therefore, b ∈ S(a) and a S b. A completely similar argument shows that, if a S b, then a R b. Thus R=S.

16 Properties of Relations
Reflexive & Irreflexive A relation R on a set A is reflexive if (a, a)∈ R for all a ∈A. A relation R on a set A is irreflexive if a R a for all a∈ A reflexive irreflexive Dom(R) =Ran(R) =A

17 Properties of Relations
Theorem 2 Let R be a relation on a set A, then (a) Reflexivity of R means that a∈R(a) for all a in A. (b) Symmetry of R means that a∈R(b) iff b∈R(a). (c) Transitivity of R means that if b∈R(a) and c∈R(b), then c∈R(a).

18 Properties of Relations
Example 1 (a) Δ = {(a,a) | a ∈A} Reflexive (b) R = {(a,b)∈A×A | a ≠ b} Irreflexive (c) A={1,2,3} and R={(1,1), (1,2)} not Reflexive ((2,2) not in R), not Irreflexive ((1,1) in R) (d) A is a nonempty set. R=Ø ⊆ A×A, the empty relation. not Reflexive, Irreflexive

19 Properties of Relations
Symmetric, Asymmetric & Antisymmetric Symmetric: if a R b, then b R a Asymmetric: if a R b, then b R a (must be irreflexive) Antisymmetric: if a ≠ b, a R b or b R a ( if a R b and b R a, then a=b ) not Symmetric: some a and b with a R b, but b R a not Asymmetric: some a and b with a R b, but b R a not Antisymmetric : some a and b with a ≠ b, but both a R b and b R a

20 Properties of Relations
Example 2 Let A=Z, the set of integers, and let R={ (a,b) ∈A×A | a < b } Is R symmetric, asymmetric, or antisymmetric? Solution: not symmetric: if a<b then b<a is not true. asymmetric: if a<b, then b<a must be true Antisymmetric: if a ≠ b, then a<b or b<a must be true

21 Properties of Relations
Example 4 Let A={1,2,3,4} and let R={(1,2), (2,2), (3,4), (4,1)} R is not symmetric, since (1,2) ∈ R, but (2,1) ∈ R. R is not asymmetric, since (2,2) ∈ R R is antisymmeric, since if a ≠ b, either (a, b) ∈ R or (b,a) ∈ R

22 Properties of Relations
Example 5 Let A=Z+, the set of positive integers, and let R={(a,b) ∈A×A | a divides b } Is R symmetric, asymmetric, or antisymmetric? Solution: not symmetric: 3 | 9 but 9 | 3 not asymmetric: 2 | 2 antisymmetric: if a | b and b | a, then a=b (Section 1.4)

23 Properties of Relations
Example 9 Let A=Z+, and R={(a,b) ∈A×A | a divides b } Is R transitive? Solution: Suppose that a R b and b R c, so that a | b and b | c. It then does follow that a | c Thus R is transitive.

24 Properties of Relations
Example 10 Let A ={1,2,3,4} and let R={(1,2),(1,3),(4,2)} Is R transitive? Solution: Since there are no elements a, b and c in A such that a R b and b R c, but a R c, R is transitive.

25 Operations on Relations
Let R and S be relations from a set A to a set B R and S are subsets of A×B. We can use set operations on the relations R and S Relations: (three representations) 1. the set of ordered pairs (finite or infinite) 2. digraph (finite) 3. matrix (finite)

26 Operations on Relations
Complementary relation if and only if a R b The intersection R ∩ S a (R ∩ S) b means that a R b and a S b The union R U S a (R U S) b means that a R b or a S b

27 Operations on Relations
Inverse Let R be a relation from A to B, the relation R-1 is a relation from B to A (reverse order from R) denoted by b R-1 a if and only if a R b Note: (R-1) -1=R Dom(R-1) = Ran (R) Ran(R-1) = Dom(R)

28 Operations on Relations
Example 1 Let A={1,2,3,4} and B= {a,b,c}. We Let R={(1,a), (1,b), (2,b),(2,c),(3,b),(4,a)} and S= {(1,b),(2,c),(3,b),(4,b)} Compute: (a) (b) R ∩ S (c) R U S (d) R-1 Solution: A×B = { (1,a), (1,b), (1,c), (2,a), (2,b), (2,c), (3,a), (3,b), (3,c), (4,a), (4,b), (4,c) }

29 Operations on Relations
Example 1 R∩S = { (1,b), (3,b), (2,c) } R∪S = { (1,a), (1,b), (2,b), (2,c), (3,b), (4,a), (4,b) } R-1= { (a,1), (b,1), (b,2), (c,2), (b,3), (a,4) }

30 Operations on Relations
Example 2 Let A=R. Let R be the relation ≤ on A and let S be ≥ Then the complement of R is the relation >, since a ≤ b means a>b Similarly, the complement of S is the relation <. On the other hand, R-1=S, since for any number a and b a R-1 b if and only if b R a if and only if b ≤ a if and only if a ≥ b if and only if a S b R ∩ S : “=” R U S : A×A

31 Operations on Relations
Theorem 1 Suppose that R and S are relations from A to B (a) If R ⊆ S, then R-1 ⊆ S-1. (b) If R ⊆ S, then S ⊆ R (c) (R∩S) -1 =R -1 ∩ S -1 and (R U S) -1 = R -1 U S -1 (d) (R∩S) = R U S and R U S = R ∩ S

32 Operations on Relations
Theorem 2 Let R and S be relations on a set A (a) If R is reflexive, so is R-1 (b) If R and S are reflexive, then so are R∩S and R U S (c) R is reflexive if and only if R is irrflexive


Download ppt "Dr. Ameria Eldosoky Discrete mathematics"

Similar presentations


Ads by Google