Presentation is loading. Please wait.

Presentation is loading. Please wait.

Discrete Structures – CNS2300

Similar presentations


Presentation on theme: "Discrete Structures – CNS2300"— Presentation transcript:

1 Discrete Structures – CNS2300
Text Discrete Mathematics and Its Applications Kenneth H. Rosen Chapter 7 Relations

2 Relations and their Properties
Section 7.1 Relations and their Properties

3 Calvin and Hobbes HEY DAD. I’LL GUESS ANY NUMBER YOU’RE THINKING OF! GO AHEAD, PICK A NUMBER! MM…. OK. I’VE GOT IT.

4 Calvin and Hobbes IS IT 92,376,051? BY GOLLY, IT IS!

5 Calvin and Hobbes

6 WAIT A MINUTE! YOU’RE JUST TRYING TO GET RID OF ME, AREN’T YOU?
Calvin and Hobbes NO, YOU’RE PSYCHIC. GO SHOW MOM. WAIT A MINUTE! YOU’RE JUST TRYING TO GET RID OF ME, AREN’T YOU?

7 Binary Relation from A to B
Let A and B be sets. A binary relation from A to B is a subset of A x B.

8 Example Let A = { a, b, c } and B = { x, y } then
A x B = {(a,x), (a,y), (b,x), (b,y), (c,x), (c,y)} Any subset of A x B is a relation from A to B. Therefore let: R1 = {(a,x), (c,y)} R2 = {(a,y), (b,x)} How many relations from A to B are there?

9 Binary Relation from A to B.
A binary relation from A to B is a set R of ordered pairs where the first element of each ordered pair comes from A and the second element comes from B. aRb denotes that (a,b) is an element of R and aRb indicates that (a,b) is not an element of R. When (a,b) belongs to R then a is related to b by R.

10 Example Let: R1 = { (a,x), (c,y) } R2 = { (a,y), (b,x) } Notation
a R1 x b R1 x b R2 x

11 Functions as Relations
A function is a relation from A to B such that every element in A is the first element of exactly one ordered pair of R.

12 A relation on the set A is a relation from A to A.
Relations on a Set. A relation on the set A is a relation from A to A. A relation on the set A is a subset of AxA

13 How Many Relations? If |A| = n then |AxA| = n2 . Since a relation is a subset of AxA then the number of relations is

14 Reflexive Relations Consider the following relations on the set {1,2,3,4} {(2,2),(2,3),(2,4),(3,2),(3,3),(3,4)} {(1,1),(1,2),(2,1),(2,2),(3,3),(4,4)} {(2,4),(4,2)} {(1,2),(2,3),(3,4)} {(1,1),(2,2),(3,3),(4,4)} {(1,3),(1,4),(2,3),(2,4),(3,1),(3,4)}

15 Symmetric Relations Consider the following relations on the set {1,2,3,4} {(2,2),(2,3),(2,4),(3,2),(3,3),(3,4)} {(1,1),(1,2),(2,1),(2,2),(3,3),(4,4)} {(2,4),(4,2)} {(1,2),(2,3),(3,4)} {(1,1),(2,2),(3,3),(4,4)} {(1,3),(1,4),(2,3),(2,4),(3,1),(3,4)}

16 Antisymmetric Relations
Consider the following relations on the set {1,2,3,4} {(2,2),(2,3),(2,4),(3,2),(3,3),(3,4)} {(1,1),(1,2),(2,1),(2,2),(3,3),(4,4)} {(2,4),(4,2)} {(1,2),(2,3),(3,4)} {(1,1),(2,2),(3,3),(4,4)} {(1,3),(1,4),(2,3),(2,4),(3,1),(3,4)}

17 Transitive Relations Consider the following relations on the set {1,2,3,4} {(2,2),(2,3),(2,4),(3,2),(3,3),(3,4)} {(1,1),(1,2),(2,1),(2,2),(3,3),(4,4)} {(2,4),(4,2)} {(1,2),(2,3),(3,4)} {(1,1),(2,2),(3,3),(4,4)} {(1,3),(1,4),(2,3),(2,4),(3,1),(3,4)}

18 Composition of Relations

19 Rn

20 Transitivity

21 Section 7.2 n-ary Relations

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

23 Databases and Relations
Students StudentName IDnumber Major GPA Ackermann Adams Chou Goodfriend Rao Stevens 231455 888323 102147 453876 678543 786576 Computer Science Physics Mathematics Psychology 3.88 3.45 3.49 3.90 2.99

24 Operations Projection Join Meet

25 Representing Relations
Section 7.3 Representing Relations

26 Using Matrices Let A = {1,2,3} and B={1,2}. Let the relation from A to B containing (a,b) if a>b. R would then equal {(2,1), (3,1), (3,2)} 1 2 3

27 Reflexive Relations

28 Symmetric SYMMETRIC NOT SYMMETRIC

29 Antisymmetric

30 Boolean Matrices Join of Matrices Union of Relations Meet of Matrices
Intersection of Relations Boolean Product of Matrices Composite Relations

31 Digraphs A directed graph, or digraph, consists of a set V of vertices (or nodes) together with a set E of ordered pairs of elements of V called edges (or arcs). The vertex a is called the initial vertex of the edge (a,b), and the vertex b is called the terminal vertex of this edge. An edge of the form (a,a) is called a loop.

32 Digraph Example a b c d V = {a,b,c,d} (b,b), (d,b), (b,d)} (a,b),
(a,d), (c,a), (c,b), E = {

33 finished


Download ppt "Discrete Structures – CNS2300"

Similar presentations


Ads by Google