1 / 17

Relations

Relations. A binary relation R from a set A to a set B is a subset of A  B. Domain of R = { a  A | (a,b)  R for some b  B} Range of R = {b  B | (a,b)  R for some a  A} Student Course Adam CS271 Adam CS301 Bill Phy101 Bill CS271

Download Presentation

Relations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Relations • A binary relation R from a set A to a set B is a subset of • AB. • Domain of R = { a  A | (a,b)  R for some b B} • Range of R = {b  B | (a,b)  R for some a  A} • Student Course • Adam CS271 • Adam CS301 • Bill Phy101 • Bill CS271 • Beth Bio101 • Beth CS271 Adam CS271 Beth CS301 Bill Phy101 Bio101

  2. Relation on a set A relation R on a set A is a relation from A to A. Example: A = { 1, 2, 3, ,4} R = { (x,y) | x,y  A, x is no greater than y and xy is a square} R= { (1,1), (1,4), ( 2,2), (4,4)} Also write xRy if (x,y) R.

  3. Properties of a relation • A relation R on a set A is • reflextive: (x,x) R for all x A. • symmetric: for all x,y  A, if (x,y) R then (y,x)  R. • antisymmetric: all x,y  A, if (x,y) R and x y, then (y,x) R. • transitive: for all x,y,z A, if (x,y) R and (y,z)  R, then (x,z)  R.

  4. Examples N = the set of natural numbers. (1) R= { (x,y) | x,y N, x > y } antisymm, trans. (2) R={ (x,y) | x,y N, x is no less than y} reflexive, antisymm, trans. (3) R = { (x,y) | x,y N, xy is even} reflexive, symm, trans.

  5. Transitivity: for all x,y,z N, suppose (x,y) R and (y,z) R. Then

  6. A relation that is symmetric and antisymmetric? R = { (x,x) | xN} Every relation on N that is both symmetric and antisymmetric must be a subset of R. Enough to show that such a relation cannot contain (x,y) for xy. Otherwise, R being symmetric implies (y,x) also in R, but since xy, antisymmerty is violated.

  7. Partial order A relation on a set which is reflexive, antisymmetric and transitive. Total order: a partial order with respect to which every pair of elements is comparable. Eg. Divide | : partial : total

  8. Application: task scheduling Given a set of partially ordered tasks. To schedule the tasks without violating the partial order. Eg. (1,2), (2,4), (3,5), (3,1) 3,1,2,5,4

  9. Equivalence A relation R on a set A is an equivalence relation if R is reflexive, symmetric and transitive. A partition on a set A is a collection  of nonempty subsets of A such that every element of A belongs to exactly one member of . Example: ={O,E} where E is the set of even integers and O the set odd integers is a partition of the set of integers. Example:  = { { 1,2,3}, {a,b,c}} is a partition of {1,a,2,b,3,c}.

  10. Theorem: Let  be a partition of a set A. Define a relation R on A such that for every pair x,yA, xRy if and only if x,y belong to the same member of . Then R is an equivalence relation.Proof: For all xA, let S(x) be the member of  which contains x. Reflexive: xRx for all xA, since S(x)=S(x). Symmetric: xRy means S(x)=S(y). So S(y)=S(x), so yRx. Transitive: if xRy and yRz, then S(x)=S(y) and S(y)=S(z), so S(x)=S(z), so xRz.

  11. Theorem Let R be an equivalence relation on a set A. Define [a] = { xA | xRa} (the equivalence class of a). Then  = {[a] | aA} is a partition of A. Proof Since R is reflexive aRa for all aA, hence [a] is nonempty for all aA.

  12. Next show that every xA belong s to exactly one member of . That is, if x [a] and x[b], then [a]=[b]. Claim: aRb (and similarly bRa). Pf: So suppose x [a] and x[b]. Then xRa and xRb. Since R is symmetric, xRa implies aRx. Now aRx and xRb, and since R is transitive, it follows that aRb.

  13. Claim: [a]  [b] Pf: For all y [a] we have yRa. Since aRb, and R is transitive, it follows that yRb, hence y[b]. Therefore [a]  [b]. Similarly, [b]  [a]. Therefore [a] = [b].

  14. Example R is the relation on the set of integers so that for integers x and y, xRy iff x-y is even. Reflexive: For every integer x, xRx since x-x = 0. Symmetric: For integers x and y, if xRy, then x-y is even, since x-y= -(y-x), y-x is also even, hence yRx.

  15. Transitive: For integers x,y and z, if xRy and yRz, then x-y and y-z are even, hence x-z = (x-y)+(y-z) is also even hence xRz. Therefore R is an equivalence. How many equivalence classes are there? [0] = the set of even integers [1] = the set of odd integers

  16. Example: R is the relation on the set of integers so that for integers x and y, xRy iff 5 | x-y. Reflexive: 5 | x-x for all integers x. Symmetric: 5 | x-y implies 5 | y-x = -(x-y) for all integers x,y. Transitive: for all integers x,y,z, if 5 | x-y and 5 | y-z then 5 | (x-y)+(y-z) = x-z. equivalence classes: [0], [1], [2], [3], [4]

  17. Example

More Related