Lecture 5 - Relations

# Lecture 5 - Relations - Relations(Computer Science Notes...

This preview shows pages 1–2. Sign up to view the full content.

Relations (Computer Science Notes) Relations A relation R on a set A is a subset of A × A R is a set of ordered pairs of elements from A. If R contains the pair (x, y), we say that x is related to y, or xRy in shorthand. We’ll write x/Ry to mean that x is not related to y For example, suppose we let A = {2, 3, 4, 5, 6, 7, 8}. We can define a relation W on A by xWy if and only if x ≤ y ≤ x + 2. Then W contains pairs like (3, 4) and (4, 6), but not the pairs (6, 4) and (3, 6). Under this relation, each element of A is related to itself. So W also contains pairs like (5, 5) We can define another relation S on A by saying that xSy is in S if x ≡ y (mod 3) X Y Properties of Relations: Reflexive Reflexive: every element is related to itself, elements related to themselves have self- loops Irreflexive: no element is related to itself Neither reflexive nor irreflexive: some elements are related to themselves but some aren’t The familiar relations ≤ and = on the real numbers are reflexive, but < is irreflexive R is reflexive if xRx for all x A R is irreflexive if x/Rx for all x A not reflexive: there is an x A, x/Ry

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern