What are relations? f: A B

Similar documents
Definition: A binary relation R from a set A to a set B is a subset R A B. Example:

Section Summary. Relations and Functions Properties of Relations. Combining Relations

CSC Discrete Math I, Spring Relations

COMP 182 Algorithmic Thinking. Relations. Luay Nakhleh Computer Science Rice University

Relations. Relations of Sets N-ary Relations Relational Databases Binary Relation Properties Equivalence Relations. Reading (Epp s textbook)

Relations Graphical View

Notes. Relations. Introduction. Notes. Relations. Notes. Definition. Example. Slides by Christopher M. Bourke Instructor: Berthe Y.

Chapter 9: Relations Relations

Today. Binary relations establish a relationship between elements of two sets

CHAPTER 1. Relations. 1. Relations and Their Properties. Discussion

Discrete Mathematics. 2. Relations

Relations. We have seen several types of abstract, mathematical objects, including propositions, predicates, sets, and ordered pairs and tuples.

Discrete Mathematics. Chapter 4. Relations and Digraphs Sanguk Noh

Relations, Functions, Binary Relations (Chapter 1, Sections 1.2, 1.3)

Math.3336: Discrete Mathematics. Chapter 9 Relations

Rela%ons and Their Proper%es. Slides by A. Bloomfield

Automata and Languages

Relations --- Binary Relations. Debdeep Mukhopadhyay IIT Madras

MAD 3105 PRACTICE TEST 2 SOLUTIONS

Relations MATH Relations. Benjamin V.C. Collins, James A. Swenson MATH 2730

Discrete Structures: Sample Questions, Exam 2, SOLUTIONS

Relationships between elements of sets occur in many contexts. Every day we deal with

Reading 11 : Relations and Functions

Massachusetts Institute of Technology 6.042J/18.062J, Fall 02: Mathematics for Computer Science Professor Albert Meyer and Dr.

Packet #5: Binary Relations. Applied Discrete Mathematics

Discrete Structures: Sample Questions, Exam 2, SOLUTIONS

Equivalence relations

A is a subset of (contained in) B A B iff x A = x B Socrates is a man. All men are mortal. A = B iff A B and B A. A B means A is a proper subset of B

Sets. Subsets. for any set A, A and A A vacuously true: if x then x A transitivity: A B, B C = A C N Z Q R C. C-N Math Massey, 72 / 125

Today s topics. Binary Relations. Inverse Relations. Complementary Relations. Let R:A,B be any binary relation.

spaghetti fish pie cake Ann X X Tom X X X Paul X X X

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

(4.2) Equivalence Relations. 151 Math Exercises. Malek Zein AL-Abidin. King Saud University College of Science Department of Mathematics

Definition: A binary relation R from a set A to a set B is a subset R A B. Example:

3. R = = on Z. R, S, A, T.

Chapter 3. Cartesian Products and Relations. 3.1 Cartesian Products

Outline Inverse of a Relation Properties of Relations. Relations. Alice E. Fischer. April, 2018

1.A Sets, Relations, Graphs, and Functions 1.A.1 Set a collection of objects(element) Let A be a set and a be an elements in A, then we write a A.

Relations, Functions, and Sequences

CS Discrete Mathematics Dr. D. Manivannan (Mani)

Relations and Equivalence Relations

Section 7.1 Relations and Their Properties. Definition: A binary relation R from a set A to a set B is a subset R A B.

Week 4-5: Binary Relations

Relations. Relations. Definition. Let A and B be sets.

Multiple Choice Questions for Review

5. Partitions and Relations Ch.22 of PJE.

CSE 20 DISCRETE MATH. Fall

Week 4-5: Generating Permutations and Combinations

Week 4-5: Binary Relations

Chapter VI. Relations. Assumptions are the termites of relationships. Henry Winkler

Math 2534 Solution to Test 3A Spring 2010

Fall Inverse of a matrix. Institute: UC San Diego. Authors: Alexander Knop

Selected Solutions to Even Problems, Part 3

Sets and Motivation for Boolean algebra

Generating Permutations and Combinations

CS100: DISCRETE STRUCTURES. Lecture 3 Matrices Ch 3 Pages:

Harvard CS121 and CSCI E-121 Lecture 2: Mathematical Preliminaries

Math 42, Discrete Mathematics

1.4 Equivalence Relations and Partitions

14 Equivalence Relations

Relations. Definition 1 Let A and B be sets. A binary relation R from A to B is any subset of A B.

Kevin James. MTHSC 412 Section 3.1 Definition and Examples of Rings

1 Initial Notation and Definitions

2 Equivalence Relations

Spring Based on Partee, ter Meulen, & Wall (1993), Mathematical Methods in Linguistics

Chapter 6. Relations. 6.1 Relations

CS2013: Relations and Functions

Linear Algebra March 16, 2019

Just the Factors, Ma am HAROLD B. REITER.

MODERN APPLIED ALGEBRA

Lecture Notes 1 Basic Concepts of Mathematics MATH 352

Equivalence, Order, and Inductive Proof

Relations (3A) Young Won Lim 3/27/18

Finite Mathematics Chapter 2. where a, b, c, d, h, and k are real numbers and neither a and b nor c and d are both zero.

CSE 20 DISCRETE MATH. Winter

Binary Relation Review Questions

Math 42, Discrete Mathematics

Divisor Problems HAROLD B. REITER.

Chapter 1. Sets and Numbers

RED. Name: Instructor: Pace Nielsen Math 290 Section 1: Winter 2014 Final Exam

DRAFT CONCEPTUAL SOLUTION REPORT DRAFT

Sets are one of the basic building blocks for the types of objects considered in discrete mathematics.

Any Wizard of Oz fans? Discrete Math Basics. Outline. Sets. Set Operations. Sets. Dorothy: How does one get to the Emerald City?

Notes on Sets, Relations and Functions

Nonnegative Matrices I

Lecture 4.3: Closures and Equivalence Relations

Solutions to In Class Problems Week 4, Mon.

9 RELATIONS. 9.1 Reflexive, symmetric and transitive relations. MATH Foundations of Pure Mathematics

Exam 2. Is g one-to-one? Is g onto? Why? Solution: g is not one-to-one, since for c A, g(b) = g(c) = c. g is not onto, since a / g(a).

1. To be a grandfather. Objects of our consideration are people; a person a is associated with a person b if a is a grandfather of b.

7.6 The Inverse of a Square Matrix

Worksheet on Relations

a + b = b + a and a b = b a. (a + b) + c = a + (b + c) and (a b) c = a (b c). a (b + c) = a b + a c and (a + b) c = a c + b c.

MATHEMATICS. IMPORTANT FORMULAE AND CONCEPTS for. Final Revision CLASS XII CHAPTER WISE CONCEPTS, FORMULAS FOR QUICK REVISION.

Properties of the Integers

Matrix operations Linear Algebra with Computer Science Application

Discrete Basic Structure: Sets

MATH Mathematics for Agriculture II

{a, b, c} {a, b} {a, c} {b, c} {a}

Module 2: Language of Mathematics

Transcription:

What are relations? Ch 9.1 What are relations? Notation Informally, a relation is a set of pairs of objects (or in general, set of n-tuples) that are related to each other by some rule. We will focus first on binary relations, or relations between two objects. Other methods can be used to express relationships. For example, functions. Functions offer only limited ability to express relationship. f: A B Has value for every a A Has only one value for every a A hips exist naturally that do not fit within the scope that functions may express. cs2311-s12-1 / 27

Relation Ch 9.1 What are relations? Notation Consider an example using the set of Actors and set of Movies from 2011. cs2311-s12 - Images from www.imdb.com 2 / 27

Relation Ch 9.1 What are relations? Notation Consider an example relation, Appeared In, between the set of Actors and set of Movies from 2011. cs2311-s12 - Images from www.imdb.com 3 / 27

Relation Ch 9.1 What are relations? Notation Consider an example relation, Appeared In, between the set of Actors and set of Movies from 2011. The relation, a set of pairs, can be written as: { (George Clooney, The Descendants), (George Clooney, The Ides of March), (Ryan Gosling, The Ides of March), (Octavia Spencer, The Help), (Emma Stone, The Help),... } The pairs define the relationship. Each pair must obey the criteria for entering the relationship. In this example, the pair (George Clooney, The Descendants) obeys the relation Appeared In. Each pair (x,y) can be read as actor x appeared in movie y. cs2311-s12-4 / 27

Preliminary Notation Ch 9.1 What are relations? Notation Definition 1. Let A and B be sets. A binary relation, R, from A to B is a subset of A B (the Cartesian product of sets A and B). A is the domain of the relation. B is the co-domain of the relation. The Appeared in relation is a subset of the Cartesian product AppearedIn {Actors} {M ovies} Definition 2. Let A be a set. A relation on A is a relation on A A. That is, a relation on a set A is a subset of A A. cs2311-s12-5 / 27

Preliminary Notation Ch 9.1 What are relations? Notation Consider the familial relation of child of. Let s give the child of relation the name C. Bob is a child of Alice may be represented as: (Bob,Alice) C, or Bob C Alice (infix notation) The negative assertion that the relation Bob is a child of Alice is not true is given as: (Bob,Alice) C, or Bob C Alice cs2311-s12-6 / 27

of a relation on A Ch 9.1 What are relations? Notation 1. Let R 1 be the relation on N 4 = {0,1,2,3} defined as ir 1 j iff i < j. Then, R 1 is defined as: R 1 = {(0,1),(0,2),(0,3),(1,2),(1,3),(2,3)} or with infix notation 0R 1 1, 0R 1 2, 0R 1 3, 1R 1 2, 1R 1 3, 2R 1 3 or with set builder notation: R 1 = {(i,j) i,j N 4 and i < j} 2. Define the relation R 2 on N by R 2 = {(i,j) i,j N and i < j} cs2311-s12-7 / 27

of Infinite Relation Ch 9.1 What are relations? Notation Compare R 1 and R 2 : R 1 = {(i,j) i,j N 4 and i < j} R 2 = {(i,j) i,j N and i < j} The difference in R 1 and R 2 are the sets over which the relation is defined, N 4 vs. N. R 2 is the relation <. That is, the < object is a set of ordered pairs. In particular, < = {(i,j) i,j N and j i > 0} It is clumsy to write 7R 2 19, but natural to write 7 < 19 an example of when to use infix notation cs2311-s12-8 / 27

Representing - Introduction Ch 9.1 Representation Digraphs of Matrix Representation Display s Many ways to represent relations: List all ordered pairs, Set builder notation, Tables, Digraphs Zero-one matrices cs2311-s12-9 / 27

Digraphs of Ch 9.1 Representation Digraphs of Matrix Representation Display s may be drawn using directed graphs such that for each member of the domain and range of R there is a node. There is a directed edge between nodes x and y iff xry. Note, we will discuss the definition and properties of graphs in the next chapter. 3. R on {1,2,3,4} where R = {(a,b) a > b} 1 2 3 4 cs2311-s12-10 / 27

Representing Using Matrices Ch 9.1 Representation Digraphs of Matrix Representation Display s A relation can be represented with a zero-one matrix. Let R be a relation from A = {a 1,...,a m } to B = {b 1,...,b n }. The relation R can be represented by the matrix M R = [m ij ] where: { 1 if (a i,b j ) R, m ij = 0 if (a i,b j ) R. That is, the matrix has a 1 at its (i,j) entry when a i is related to b j and a 0 when they are not related. cs2311-s12-11 / 27

s of Ch 9.1 Representation Digraphs of Matrix Representation Display s Let A = { McDonald s, Burger King, KFC, Taco Bell, Subway } Let B = { Hamburger, Fish Sandwich, Mashed Potatoes, Ham Sandwich, Taco, BBQ } A relation R from A to B describes which restaurant sells a food item. R = { (McDonald s, Hamburger), (Burger King, Hamburger), (McDonald s Fish Sandwich), (Burger King, Fish Sandwich), (KFC, Mashed Potatoes), (Subway, Ham Sandwich), (Taco Bell, Taco) } Or, the relation can be expressed... cs2311-s12-12 / 27

Displaying Ch 9.1 Representation Digraphs of Matrix Representation Display s as a graph, with a matrix, or in a table. McDonald s Burger King KFC Taco Bell Subway Hamburger Fish Sandwich Mashed Potatoes Ham Sandwich Taco BBQ M R = 1 1 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 Fish Mashed Ham R Hamburger Sandwich Potatoes Sandwich Taco BBQ McDonald s X X BurgerKing X X KFC X Taco Bell X Subway X cs2311-s12-13 / 27

with Digraphs Ch 9.1 Representation Digraphs of Matrix Representation Display s 4. Draw the directed graph for the relation on {1,2,3,4}. cs2311-s12-14 / 27

Representing a Relation Graphically Ch 9.1 Representation Digraphs of Matrix Representation Display s Two graphical representations of the relation on {1,2,3,4}. 1 2 3 4 Also, tabular and matrix representations. 1 2 3 4 1 X X X X 2 X X X 3 X X 4 X 1 2 3 4 1 2 M = 3 4 1 1 1 1 0 1 1 1 0 0 1 1 0 0 0 1 cs2311-s12-15 / 27

: Reflexive Ch 9.1 Reflexive Symmetric Antisymmetric Transitive Other Properties Definition 3. A relation R on a set A is reflexive if (a,a) R for every element a A. Definition 3a. (graphical) R is reflexive if every node a has an edge circling back to it (self-loop). Definition 3b. (matrix) R is reflexive if all the elements on the main diagonal of M R are 1. cs2311-s12-16 / 27

: Symmetric Ch 9.1 Reflexive Symmetric Antisymmetric Transitive Other Properties Definition 4. A relation R on a set A is symmetric if (b,a) R whenever (a,b) R, for all a,b, A. Definition 4a. (graphical) R is symmetric if all edges are two-way (bi-directional), or are self-loops. Definition 4b. (matrix) R is symmetric if and only if m ij = m ji for all pairs of integers, i,j. That is, M R = M T R. cs2311-s12-17 / 27

: Antisymmetric Ch 9.1 Reflexive Symmetric Antisymmetric Transitive Other Properties Definition 5. A relation R on a set A is antisymmetric if for all a,b A if (a,b) R and (b,a) R, then a = b. Definition 5a. (graphical) R is antisymmetric if there are no two-way (bi-directional) edges. Definition 5b. (matrix) R is antisymmetric if either m ij = 0 or m ji = 0 when i j. cs2311-s12-18 / 27

: Transitive Ch 9.1 Reflexive Symmetric Antisymmetric Transitive Other Properties Definition 6. A relation R on a set A is called transitive if whenever (a,b) R and (b,c) R, then (a,c) R for all a,b,c, A. Definition 6a. (graphical) R is transitive if for all nodes a and b, if you can get from a to b in two edges then you can get from a to b in one edge. Definition 6b. (matrix) No simple visual check. cs2311-s12-19 / 27

of Relation Properties Ch 9.1 Reflexive Symmetric Antisymmetric Transitive Other Properties For each example, determine whether the relation described is: reflexive, symmetric, antisymmetric, and transitive. 5. The < relation on N. 6. The relation on N. 7. A relation on {1,2,3,4} defined as: {(3,2),(1,1)} 8. A relation on {a,b,c,d} defined as: {(a,a)(b,c),(d,d),(c,b)} cs2311-s12-20 / 27

Additional Relation Properties Ch 9.1 Reflexive Symmetric Antisymmetric Transitive Other Properties Definition 7. A relation R on set A is asymmetric if (a,b) R implies that (b,a) R for all a,b A. Definition 8. A relation R on set A is irreflexive if (a,a) R for every element a A. cs2311-s12-21 / 27

Equivalence Ch 9.1 Equivalence Equivalence Classes Partition A relation on a set A is called an equivalence relation if it is reflexive, symmetric, and transitive. Two elements a and b that are related by an equivalence relation are called equivalent and denoted as a b. 9. Let R be the relation on the set of real numbers such that (a,b) R if and only if a b is an integer. Is R an equivalence relation? 10. Which of the following are equivalence relations over the set {1,2,3,4,5}? {(1,1),(2,2),(3,3),(1,3),(3,1),(2,3),(3,2),(1,2),(2,1)} {(1,1),(3,3),(5,5),(1,5),(5,1),(5,3),(1,3),(3,1),(2,2),(4,4)} cs2311-s12-22 / 27

Equivalence Classes Ch 9.1 Equivalence Equivalence Classes Partition Let R be an equivalence relation on A. The set of all elements that are related to an element a of A is called the equivalence class of a and is denoted by [a] R. [a] R = {x (a,x) R} If b [a] R then b is a representative of the equivalence class. 11. What are the equivalence classes of the following relation, R, on {1,2,3,4,5,6}? R = {(1,1),(1,3),(1,5),(3,1),(3,3),(3,5),(5,1), (5,3),(5,5),(2,2),(2,6),(6,2),(6,6),(4,4)} cs2311-s12-23 / 27

Equivalence Classes and Partitions Ch 9.1 Equivalence Equivalence Classes Partition A partition of a set S is a collection of disjoint nonempty subsets of S that have S as their union. Given a collection of n subsets of S, A = {A 1,A 2,...,A n } is a partition if and only if i, A i i,j i j,a i A j = A i = S i 12. Let S = {1,2,3,4,5,6}. The collection of sets A 1 = {1,2,3}, A 2 = {4,5}, and A 3 = {6} forms a partition of S. cs2311-s12-24 / 27

Equivalence Classes and Partitions Ch 9.1 Equivalence Equivalence Classes Partition Theorem 1. Let R be an equivalence relation on a set S. Then the equivalence classes of R form a partition of S. Conversely, given a partition {A i i I} of the set S, there is an equivalence relation R that has the sets A i, i I as its equivalence classes. For each a S let [a] R = {s S (a,s) R}. Then, is a partition of S. B = {[a] R a S} cs2311-s12-25 / 27

Partial - Introduction Ch 9.1 Partial Ordering may be used to order some or all elements of a set. For instance, a relation containing pairs of words (a, b) where a comes before b in the dictionary using lexicographic ordering. A relation R on a set S is called a partial ordering or partial order if it is reflexive, antisymmetric, and transitive. A set S together with a partial ordering R is called a partially ordered set or poset, and is denoted by (S,R). Members of S are called elements of the poset. Show that the following relations are either partial ordering on not: The relation on the set of integers. The relation on the set of people such that (x,y) R if x is older than y. cs2311-s12-26 / 27

Partial Ch 9.1 Partial Ordering The elements a and b of a poset (S,R) are called comparable if either arb or bra. When a and b are elements of S such that neither arb nor bra, a and b are incomparable. The term partial is used because pairs of elements may be incomparable. When all pairs of elements in the set are comparable, then the relation is a total ordering. cs2311-s12-27 / 27