chapter 2: relations

25
MATH301- DISCRETE MATHEMATICS Copyright © Nahid Sultana 2014-2015. Dr. Nahid Sultana Email: [email protected] Chapter 2: Relations 10/10/2014 1

Upload: nszakir

Post on 05-Dec-2014

87 views

Category:

Science


6 download

DESCRIPTION

Mathematics; Product sets; Relations; Inverse Relation; Representing Relations Using Matrices; Composition of Relations; Types of Relations; Reflexive and Irreflexive Relations; Symmetric and Antisymmetric Relations; Transitive Relations Equivalence Relations Partial Ordering Relations Closure Properties

TRANSCRIPT

Page 1: Chapter 2: Relations

MATH301- DISCRETE MATHEMATICS

Copyright © Nahid Sultana 2014-2015.

Dr. Nahid Sultana

Email: [email protected]

Chapter 2: Relations

10/10/2014

1

Page 2: Chapter 2: Relations

Topics

10/10/2014

2

Product sets Relations

Inverse Relation, Representing Relations Using Matrices

Composition of Relations Types of Relations

Reflexive and Irreflexive Relations Symmetric and Antisymmetric Relations Transitive Relations

Equivalence Relations Partial Ordering Relations Closure Properties

Copyright © Nahid Sultana 2014-2015.

Page 3: Chapter 2: Relations

Product sets

Definition: The ordered pair (x , y) is a single element consisting of pair of elements in which

x is the first element (coordinate)

y is the second element (coordinate).

Definition: Two ordered pair (x , y) and (w , z) will be equal if

x = w and y = z.

Note:

If {a, b} is a set, {a, b}= {b, a} If (a, b) is an ordered pair, then (a, b) ≠ (b, a)

10/10/2014

3

Copyright © Nahid Sultana 2014-2015.

Page 4: Chapter 2: Relations

Cartesian Product

10/10/2014

4

Definition: The Cartesian product of two sets A and B is the set of

all ordered pairs (a, b) with

Example: Let A = {x, y} and B = {1, 2}. Compute .

Copyright © Nahid Sultana 2014-2015.

Page 5: Chapter 2: Relations

Relations

10/10/2014

5

Definition: A Relation R from set A to set B is a subset of A × B.

If (a , b) ∈ R, we say that “a is related to b", and write aRb.

If (a , b) ∉ R, we say that “a is not related to b“, and write aRb. If A = B, we often say that R ∈ A × A is a relation on A.

Example: A = (1, 2, 3) and B = {x, y, z}, and let R = {(1, y), (1, z), (3, y)}.

Then R is a relation from A to B ? . Yes--since R is a subset of A × B

With respect to this relation,

Copyright © Nahid Sultana 2014-2015.

Page 6: Chapter 2: Relations

Relations

Solution: Note that these relations are on an infinite set and each of these relations is an infinite set. Checking the conditions that define each relation, we see that

(1,1) is in R1, R3, R4 , and R6: (1,2) is in R1 and R6: (2,1) is in R2, R5, and R6: (1, −1) is in R2, R3, and R6 : (2,2) is in R1, R3, and R4.

Example: Consider these relations on the set of integers: R1 = {(a,b) | a ≤ b}, R4 = {(a,b) | a = b}, R2 = {(a,b) | a > b}, R5 = {(a,b) | a = b + 1}, R3 = {(a,b) | a = b or a = −b}, 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)?

10/10/2014

6

Copyright © Nahid Sultana 2014-2015.

Page 7: Chapter 2: Relations

Relations (Cont…)

10/10/2014

7

Definition: The domain of relation R is the set of all first elements of the ordered pairs which belong to R, denoted by Dom(R).

Definition: The range is the set of second elements of the ordered pairs which belong to R, denoted by Ran(R).

Example: A = (1, 2, 3) and B = {x, y, z}, and consider the relation R = {(1, y), (1, z), (3, y)}.

Find the domain and range of R.

The domain of R is Dom(R) = {1, 3} The range of R is Ran(R) = {y, z}

Copyright © Nahid Sultana 2014-2015.

Page 8: Chapter 2: Relations

Inverse Relations

10/10/2014

8

Definition: Let R be any relation from set A to B. The inverse of R, denoted by R-1, is the relation from B to A denoted by

R-1 = {(b , a)|(a , b)∈ R}

Example: let A = {1, 2, 3} and B = {x, y, z}. Find the inverse of R = {(1, y), (1 , z), (3 , y)}

Solution: R−1 = {(y , 1), (z , 1), (y , 3)}

If R is any relation, then (R-1)-1 = R. The domain and range of R-1 are equal to the range and domain of R, respectively. If R is a relation on A, then R-1 is also a relation on A.

Copyright © Nahid Sultana 2014-2015.

Page 9: Chapter 2: Relations

Representing Relations Using Matrices

A relation between finite sets can be represented using a zero-one matrix.

Suppose R is a relation from A = {a1, a2, …, am} to B = {b1, b2, …, bn}.

The elements of the two sets can be listed in any particular arbitrary order. When A = B, we use the same ordering.

The relation R is represented by the matrix

MR = [mij], where

The matrix representing R has a 1 as its (i,j) entry when ai is related to bj and a 0 if ai is not related to bj.

10/10/2014

9

Copyright © Nahid Sultana 2014-2015.

Page 10: Chapter 2: Relations

Examples of Representing Relations Using Matrices

Example 1: 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 (assuming the ordering of

elements is the same as the increasing numerical order)?

Solution: Here R = {(2,1), (3,1),(3,2)}. The matrix representing R is

10/10/2014

10

Copyright © Nahid Sultana 2014-2015.

Page 11: Chapter 2: Relations

Examples of Representing Relations Using Matrices (cont.)

Example 2: Let A = {a1,a2, a3} and B = {b1,b2, b3,b4, b5}.

Which ordered pairs are in the relation R represented by

the matrix

Solution: R = {(a1, b2), (a2, b1),(a2, b3), (a2, b4),(a3, b1), {(a3, b3), (a3, b5)}.

10/10/2014

11

Copyright © Nahid Sultana 2014-2015.

Page 12: Chapter 2: Relations

Composition of Relations

10/10/2014

12

Definition: Suppose A, B and C are sets, and

R is a relation from A to B S is a relation from B to C Then the composition of R and S, denoted by R ∘ S, is a relation from A to C defined by

R ∘ S = {(a , c)| ∃ b ∈ B, for which (a , b) ∈ R and (b , c) ∈ S}

Example: Let A = {1, 2, 3, 4}, B = {a, b, c, d}, C = {x, y, z} and let R = {(1, a), (2, d), (3, a), (3, b), (3, d)} and S = {(b, x), (b, z), (c, y), (d, z)}

Compute R ∘ S .

Using arrow diagram, R ◦ S={(2,z), (3,x), (3,z)} Copyright © Nahid Sultana 2014-2015.

Page 13: Chapter 2: Relations

Composition of Relations (Cont…)

10/10/2014

13

Example: Let A = {1, 2, 3, 4}, B = {a, b, c, d}, C = {x, y, z} and let R = {(1, a), (2, d), (3, a), (3, b), (3, d)} and S = {(b, x), (b, z), (c, y), (d, z)}. Compute R ∘ S .

There is another way of finding R ◦ S. Let MR and MS denote the matrix representations of the relations R and S, respectively. Then

The nonzero entries in this matrix tell us which elements are related by R◦S. Thus R ◦ S={(2,z), (3,x), (3,z)}

Multiplying MR and MS

Copyright © Nahid Sultana 2014-2015.

Page 14: Chapter 2: Relations

Types of relations

10/10/2014

14

Types of relations which are defined on a set A. Reflexive and Irreflexive Relations Symmetric and Antisymmetric Relations Transitive Relations

Definition: A relation R on a set A is reflexive if (a,a) ∈ R for all a ∈ A. Thus R is not reflexive if there exists a ∈ A such that (a, a)∉ R.

Example: Consider the following relations on the set A = {1, 2, 3}: R1 = {(1, 1)(1, 2), (2, 1), (2, 2), (3, 3)}

R2 = {(1, 1), (1, 2), (2, 1), (2, 2)} R3 = Φ

Determine which relation is reflexive. Copyright © Nahid Sultana 2014-2015.

Page 15: Chapter 2: Relations

Types of relations (Cont…)

10/10/2014

15

Example: The following relations on the integers are reflexive:

R1 = {(a,b) | a ≤ b},

R3 = {(a,b) | a = b or a = −b},

R4 = {(a,b) | a = b}.

The following relations are not reflexive:

R2 = {(a,b) | a > b} (note that 3 ≯ 3),

R5 = {(a,b) | a = b + 1} (note that 3 ≠3 + 1),

R6 = {(a,b) | a + b ≤ 3} (note that 4 + 4 ≰ 3).

Copyright © Nahid Sultana 2014-2015.

Page 16: Chapter 2: Relations

Types of relations (Cont…)

10/10/2014

16

Definition: A relation R on a set A is symmetric if whenever aRb then bRa, i.e., if whenever (a, b) ∈ R then (b, a) ∈ R.

Thus R is not symmetric if there exists a, b ∈ A such that (a, b) ∈ R but (b, a) ∉ R.

Example: Consider the following relations on the set A = {1, 2, 3}: R1 = {(1, 1)(1, 2), (2, 1), (2, 2), (3, 3)}

R2 = {(1, 1), (1, 2), (2, 2)} Determine which relation is symmetric.

Copyright © Nahid Sultana 2014-2015.

Page 17: Chapter 2: Relations

Types of relations (Cont…)

10/10/2014

17

Definition: A relation R on a set A is antisymmetric if whenever aRb and bRa then a = b.

Example: Consider the following relations on the set A = {1, 2, 3}: R1 = {(1, 1)(1, 2), (2, 1), (2, 2), (3, 3)}

R2 = {(1, 1), (1, 2)} Determine which relation is antisymmetric.

The contrapositive of this definition is that R is antisymmetric if whenever a ≠ b, then either (a,b) ∉ R or (b,a) ∉ R.

Definition: A relation R is not antisymmetric if there exist a, b ∈ A such that (a,b)∈ R and (b, a) ∈ R but a ≠ b.

Note: Not symmetric ≠ antisymmetric . Copyright © Nahid Sultana 2014-2015.

Page 18: Chapter 2: Relations

Types of relations (Cont…)

10/10/2014

18

Example: Consider the following relations on the set A = {1, 2, 3}: R1 = {(1, 1), (1, 2), (2, 3), (1, 3)}

R2 = {(1, 1), (1, 2), (2,2), (2,3)} R3 = {(1, 1), (1, 2), (1,3), (3,3)}

Determine which relation is transitive.

Definition: A relation R on a set A is transitive if whenever aRb and bRc then aRc, that is, if whenever (a, b)∈R and (b, c)∈ R then (a, c)∈R.

Thus R is not transitive if there exist a, b, c ∈ R such that (a,b)∈ R and (b, c) ∈ R but (a,c) ∉ R. If such a, b and c not exist, then R is transitive.

Copyright © Nahid Sultana 2014-2015.

Page 19: Chapter 2: Relations

Equivalence relation

10/10/2014

19

Example: Consider the following relation on the set A = {1, 2, 3,4}: R = {(1, 1), (1, 2), (2,1), (2,2), (3,4), (4,3), (3,3), (4, 4)} Determine whether this relation is equivalence or not.

Definition: A relation R on a set A is called an equivalence

relation if R is reflexive, symmetric, and transitive. It follows three properties:

1) For every a ∈ A, aRa. 2) If aRb then bRa. 3) If aRb and bRc, then aRc.

The relation R is equivalence because R is reflexive, symmetric and transitive.

Copyright © Nahid Sultana 2014-2015.

Page 20: Chapter 2: Relations

Equivalence relation (cont…)

10/10/2014

20

Example: Let A= ℤ, set of integers. Let R be defined by aRb

iff a ≤ b. Determine whether this relation is equivalence or not.

Therefore the relation R is not an equivalence.

Solution:

1) The relation R is reflexive a ≤ a.

2) The relation R is not symmetric a ≤ b does not imply that b ≤ a .

3) The relation R is transitive because a ≤ b and b ≤ c imply that a ≤ c.

Copyright © Nahid Sultana 2014-2015.

Page 21: Chapter 2: Relations

Equivalence relation (cont…)

10/10/2014

21

Example: Prove that congruence modulo n is an equivalence relation on ℤ.

Definition: For a given positive integer n ≥ 2, two integers a and b are called congruent modulo n, written as

a ≡ b(mod n)

if a - b is divisible by n.

Solution: 1) Reflexivity: For any a ∈ ℤ, we have a ≡ a(mod n) because a-

a=0 is divisible by n. Hence the relation is reflexive. Cont to next slide…..

Copyright © Nahid Sultana 2014-2015.

Page 22: Chapter 2: Relations

Equivalence relation (cont…)

10/10/2014

22

2) Symmetry: suppose a ≡ b(mod n) ⇒ a-b is divisible by n ⇒ (a-b)/n = k , for some k ∈ℤ ⇒ a-b = nk .

Therefore, b-a = -(a-b) = -nk = n(-k) ⇒(b-a)/n = -k, so b-a is divisible by n as -k∈ℤ i.e. b ≡ a(mod n). Thus the relation is symmetric.

3) Transitivity: suppose a ≡ b (mod n) and b ≡ c (mod n), then (a-b)/n =k and (b-c)/n=l for some k,l∈ℤ. i.e. a-b=nk and b-c=nl.

By adding this two equations we get, a-c=n(k+l)⇒(a-c)/n=k+l. So a-c is divisible by n as k+l ∈ℤ, i.e. a ≡ c(mod n). Thus the relation is transitive.

Hence this is an equivalence relation on ℤ. Copyright © Nahid Sultana 2014-2015.

Solution: Cont…..

Page 23: Chapter 2: Relations

Equivalence class (cont…)

10/10/2014

23

Definition: For an equivalence relation R defined on A and for a∈ A, the set

[a] = {x ∈ A| (a, x) ∈R}

is called the equivalence class of a in A.

Definition: Any b ∈ [a] is called a representative of this equivalence class.

Definition: The collection of all equivalence classes of elements of A under an equivalence relation R is called the quotient set, denoted by A/R, i.e.

A/R = {[a] | a ∈ A}. Note: The quotient set A/R is a partition of A.

Copyright © Nahid Sultana 2014-2015.

Page 24: Chapter 2: Relations

Partial Orderings

10/10/2014

24

Definition : A relation R on a set S is called a partial ordering, or partial order, if it is reflexive, antisymmetric, and transitive.

Definition: A set A together with a partial ordering R is called a partially ordered set or poset.

Example: Show that the “greater than or equal” relation (≥) is a partial ordering on the set of integers. Solution:

Reflexivity: a ≥ a for every integer a. Antisymmetry: If a ≥ b and b ≥ a , then a = b. Transitivity: If a ≥ b and b ≥ c , then a ≥ c.

Copyright © Nahid Sultana 2014-2015.

Page 25: Chapter 2: Relations

Closure Properties

10/10/2014

25

Suppose R is a relation on A

If R does not possess a particular relation (reflexive, symmetric, transitive)

Then we may add as few new pairs as possible until we get a new relation R1 on A that have that required property.

If such R1 exists, we call it the closure of R with respect to that property.

Example: Reflexive closure, Symmetric closure, Transitive closure.

Copyright © Nahid Sultana 2014-2015.