Relations I. Margaret M. Fleck. 7 November 2008

Similar documents
MATH 22 MORE ABOUT FUNCTIONS. Lecture M: 10/14/2003. Form follows function. Louis Henri Sullivan

Lecture 3: Recursion; Structural Induction

Chapter 3. Set Theory. 3.1 What is a Set?

Grade 6 Math Circles November 6 & Relations, Functions, and Morphisms

Graph Coloring. Margaret M. Fleck. 3 May This lecture discusses the graph coloring problem (section 9.8 of Rosen).

Math 187 Sample Test II Questions

Introduction to Sets and Logic (MATH 1190)

Sets. Margaret M. Fleck. 15 September 2010

Binary Relations McGraw-Hill Education

Set and Set Operations

CS 441 Discrete Mathematics for CS Lecture 24. Relations IV. CS 441 Discrete mathematics for CS. Equivalence relation

10/11/2018. Partial Orderings. Partial Orderings. Partial Orderings. Partial Orderings. Partial Orderings. Partial Orderings

AXIOMS FOR THE INTEGERS

Material from Recitation 1

CS2 Algorithms and Data Structures Note 10. Depth-First Search and Topological Sorting

CSE 20 DISCRETE MATH. Fall

14.1 Encoding for different models of computation

Complexity Theory. Compiled By : Hari Prasad Pokhrel Page 1 of 20. ioenotes.edu.np

CS 3512, Spring Instructor: Doug Dunham. Textbook: James L. Hein, Discrete Structures, Logic, and Computability, 3rd Ed. Jones and Barlett, 2010

Lecture 1: Overview

Sets 1. The things in a set are called the elements of it. If x is an element of the set S, we say

Lecture 3: Linear Classification

Chapter 1. Math review. 1.1 Some sets

Discrete Mathematics. Kruskal, order, sorting, induction

Lattice Tutorial Version 1.0

Propositional Logic. Part I

Binary Relations Part One

EC121 Mathematical Techniques A Revision Notes

Recursively Enumerable Languages, Turing Machines, and Decidability

CHAPTER 8. Copyright Cengage Learning. All rights reserved.

CMPSCI 250: Introduction to Computation. Lecture #1: Things, Sets and Strings David Mix Barrington 22 January 2014

Notebook Assignments

CS103 Spring 2018 Mathematical Vocabulary

Variables and Data Representation

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

CS 4349 Lecture October 18th, 2017

CS103 Handout 14 Winter February 8, 2013 Problem Set 5

Lecture 19: Topological sort Part 1: Problem and math basis. Topological sort. The problem. Why we are doing this!

1. Represent each of these relations on {1, 2, 3} with a matrix (with the elements of this set listed in increasing order).

Planar Graphs and Surfaces. Graphs 2 1/58

Cardinality of Sets MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Cardinality of Sets Fall / 15

Chapter 4. Number Theory. 4.1 Factors and multiples

Relations, Equivalence Relations, and Partial Orders

MITOCW watch?v=kz7jjltq9r4

p x i 1 i n x, y, z = 2 x 3 y 5 z

13 th Annual Johns Hopkins Math Tournament Saturday, February 18, 2012 Explorations Unlimited Round Automata Theory

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

Lecture Transcript While and Do While Statements in C++

CSE 20 DISCRETE MATH. Winter

9.5 Equivalence Relations

Teacher Activity: page 1/9 Mathematical Expressions in Microsoft Word

Slides for Faculty Oxford University Press All rights reserved.

LECTURE NOTES ON SETS

CS Bootcamp Boolean Logic Autumn 2015 A B A B T T T T F F F T F F F F T T T T F T F T T F F F

CS 341 Homework 1 Basic Techniques

Objective- Students will be able to use the Order of Operations to evaluate algebraic expressions. Evaluating Algebraic Expressions

CS 1200 Discrete Math Math Preliminaries. A.R. Hurson 323 CS Building, Missouri S&T

Projective geometry and the extended Euclidean plane

A set with only one member is called a SINGLETON. A set with no members is called the EMPTY SET or 2 N

CS103 Handout 13 Fall 2012 May 4, 2012 Problem Set 5

Comparing sizes of sets

1.2 Adding Integers. Contents: Numbers on the Number Lines Adding Signed Numbers on the Number Line

Formal Methods of Software Design, Eric Hehner, segment 24 page 1 out of 5

Antisymmetric Relations. Definition A relation R on A is said to be antisymmetric

9. MATHEMATICIANS ARE FOND OF COLLECTIONS

2. CONNECTIVITY Connectivity

Slide Set 1. for ENEL 339 Fall 2014 Lecture Section 02. Steve Norman, PhD, PEng

Math 5320, 3/28/18 Worksheet 26: Ruler and compass constructions. 1. Use your ruler and compass to construct a line perpendicular to the line below:

: Dimension. Lecturer: Barwick. Wednesday 03 February 2016

Program Verification & Testing; Review of Propositional Logic

Equality for Abstract Data Types

PRIMES Circle: High School Math Enrichment at MIT

Semantics via Syntax. f (4) = if define f (x) =2 x + 55.

Adding content to your Blackboard 9.1 class

Ramsey s Theorem on Graphs

Suggested problems - solutions

Graphs and trees come up everywhere. We can view the internet as a graph (in many ways) Web search views web pages as a graph

CS 4349 Lecture August 21st, 2017

Slide Set 2. for ENCM 335 in Fall Steve Norman, PhD, PEng

Solving Linear Recurrence Relations (8.2)

Lecture 1: An Introduction to Graph Theory

CS314: FORMAL LANGUAGES AND AUTOMATA THEORY L. NADA ALZABEN. Lecture 1: Introduction

University of South Carolina Math 222: Math for Elementary Educators II Instructor: Austin Mohr Section 002 Fall Midterm Exam Solutions

Chapter 3: Theory of Modular Arithmetic 1. Chapter 3: Theory of Modular Arithmetic

CSC Discrete Math I, Spring Sets

ELEC-270 Solutions to Assignment 5

Proofwriting Checklist

Functional Programming in Haskell Prof. Madhavan Mukund and S. P. Suresh Chennai Mathematical Institute

Properties and Definitions

Interlude: Problem Solving

CHAPTER 1: INTEGERS. Image from CHAPTER 1 CONTENTS

Surfaces. 14 April Surfaces 14 April /29

Sets MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Sets Fall / 31

9/19/12. Why Study Discrete Math? What is discrete? Sets (Rosen, Chapter 2) can be described by discrete math TOPICS

SETS. Sets are of two sorts: finite infinite A system of sets is a set, whose elements are again sets.

COMS 1003 Fall Introduction to Computer Programming in C. Bits, Boolean Logic & Discrete Math. September 13 th

Computer Science 236 Fall Nov. 11, 2010

(Provisional) Lecture 08: List recursion and recursive diagrams 10:00 AM, Sep 22, 2017

CS125 : Introduction to Computer Science. Lecture Notes #11 Procedural Composition and Abstraction. c 2005, 2004 Jason Zych

Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103. Chapter 2. Sets

Transcription:

Relations I Margaret M. Fleck 7 November 2008 This lecture covers relations and basic properties of relations, which is most of section 8.1 of Rosen. 1 Announcements Model solutions for the second midterm will be posted as soon as we finish doing makeup exams, which will probably be mid next week. 2 Relations Suppose that A and B are sets. A relation from A to B is a subset of A B. That is, it s a set of ordered pairs (a, b) where a A and b B. For example, suppose that A is a set of US states and B is the set of US political parties. We could create a relation S that associates each state with the parties of its senators. So S would contain the pair (Illinois, Democrat) since both of our senators are democrats. And it contains (Utah, Republican) because they have two Republican senators. Notice that S isn t a function. Iowa has one senator of each party. So S must contain both the pairs (Iowa, Democrat) and (Iowa, Republican). A relation from A to B can associate an element of A with multiple elements of B, or no elements of B. For example, we could extend our set A to include the District of Columbia, even though it doesn t have a senator. 1

Relations are a very general construct, which unifies a wide range of examples that probably don t look very similar to you. In fact, much of the time, we will be looking at one or another special type of relation. 3 Functions and relations Functions are one special case of relations. For example, suppose we want to associate each state with its capital. We can describe this as a relation F from the set of US states (A) to the set of US cities (C) So F is a set containing pairs like (Massachusetts, Boston) and (Iowa, Des Moines). In this case, the relation happens to associate each state with exactly one city. So we can also describe C as a function from A to C. You can formally define a function from A to B as a relation from A to B such that each element of A is associated with exactly one element of B. Or you can think of a relation as a generalized type of function, which allows missing or multiple outputs for certain inputs. Many mathematical applications use partial functions, which are functions that might not return a value for every input. Similarly, many programming languages let you define procedures that do not return a value. Some programming languages even let you define procedures that return multiple values. If a relation is a function, it s usually more convenient to define it as a function and use function notation. So, if we observe them in the wild, mathematicians normally call something a relation only when it isn t a function, or they are worried that it might not turn out to be a function. 4 Relations and databases The facts stored in a computer database are also relations. For this application, we need to generalize our notion of relation to more than two sets. For example, a simple registration database might contain 4-tuples like (Jean Luc Picard, Math CS 173, Fall 2325, A-) 2

(James T. Kirk, CS 173, Spring 2248, B) (Kathryn Janeway, Math 347, Fall 2345, A+) So this database is a subset of A B C D, where A is the set of students, B is the set of courses, C is the set of terms, and D is the set of letter grades. Database records don t look at all like functions, because there s often no obvious way to identify one field as the input. The whole point of a database is to let us easily switch perspective and organize the data according to a different field, e.g. sort students by name or by grade. We won t make much use of n-ary relations in this class. If you are curious about database applications, look in section 8.2 of Rosen. 5 Relations on a single set The final big group of relations are relations that associate two elements of the same set. A relation R on a set A is a relation from A to A, or equivalently, a subset of A A. That is, R is a set of pairs of elements from A. For example, suppose we let A = {2, 3, 4, 5, 6, 7} We can define a relation R on A by (x, y) R if and only if x y 2. This relation contains the pairs (3, 4) and (4, 6) and (6, 4), but not the pair (3, 6). Another relation on A is the familiar = relation. It contains only pairs whose two elements are identical, such as (5, 5) and (3, 3). Another similar relation is congruence mod 3 ( 3 ). The 3 relation contains a wider range of pairs, e.g. (4, 7) and (6, 3). Relations like these, which resemble equality, are known as equivalence relations. We ll get back to defining them precisely in a couple lectures. Order relations such as < and are also relations on the set A. example, the relation contains pairs like (5, 4) and (7, 2) and (5, 5). No one said that a relation needs to involve finite sets or even onedimensional sets. We can define similar relations on infinite sets. For example, normal numerical is a relation on the set of integers or the set of 3 For

real numbers. Another example: we can define a relation T on the real plane R 2 in which (x, y) is related to (p, q) if and only if x 2 + y 2 = p 2 + q 2. In other words, two points are related if they are the same distance from the origin. 6 Random relations No one said that a relation had to make sense or have any practical use. For example, let s let A = {a, b, c, d}. We can select any random subset of A A to be a relation. For example, R = {(a, a), (b, a), (c, d), (d, d)} is a perfectly good relation on A. Wierdo relations like this are often easiest to represent by making a table showing which pairs are in the set, or by drawing a dot-and-arrow diagram of the relation. [See pictures pp. 520 521 of Rosen. Notice that we can do the dot-and-arrow diagram with either one copy of the points or two copies.] If a set A has n elements, how many possible relations are there on A? A A contains n 2 elements. A relation is just a subset of A A, and so there are 2 n2 relations on A. So a 3-element set has 2 9 = 512 possible relations. Yup: most of these relations are of no practical use whatsoever. Most of the time, you will be manipulating relations generated by some underlying pattern and, thus, make more sense. Just be aware that these random guys are also legitimate relations. 7 Properties of relations: reflexive Familiar relations such as = and < have certain special properties which make them especially useful, both in proofs and in practical applications. Moreover, some relations seem to be structurally similar: similar properties for apparently similar reasons. For example, and and divides. We can make these intuitions concrete by classifying relations according to certain key properties. The commonly-used properties are: reflexive, irreflexive, symmetric, antisymmetric, and transitive. Relations that act like equality are all reflexive, symmetric, and transitive. Relations that act like < are all irreflexive, anti- 4

symmetric, and transitive. And so forth. A relation R on a set A is reflexive if every element is related to itself. That is, for every x A, (x, x) R. For example, normal equality (on the integers, or on the reals, or on sets of integers, or whatever) is reflexive. Another example: let B contain sets of UIUC students. So B might contain {Hanna, Melissa} and {John, Marco, Oscar} and so forth. Let s define a relation R by saying that x and y are in R iff x = y (i.e x and y contain the same number of people. R isn t equality, because two non-equal elements can be related. For example, R contains ({Hanna, Melissa}, {Yunsook, Jaebum}). But R is reflexive, because every set of students is related to itself. Yet another example: the relation on B is reflexive, because every set is a subset of itself. 8 Irreflexive A relation R on a set A is irreflexive if every element is not related to itself. That is, for every x A, (x, x) R. For example, the < relation on the integers is irreflexive, because no integer is less than itself. Notice that irreflexive is not the negation of reflexive. Let s look at the definitions more closely: reflexive: x A, (x, y) R not reflexive: x A, (x, y) R. irreflexive: x A, (x, y) R So we can have a relation which is neither reflexive nor irreflexive, if some elements are related to themselves and some aren t. For example, let s define a relation S on the integers by (x, y) S if and only if x + y = 0. (2, 2) isn t in S, but (0, 0) is. 5

9 Symmetric and antisymmetric Another important property of a relation is whether the order matters within each pair. That is, if (x, y) is in R, is (y, x) always in R? A relation satisfying this property is called symmetric. Generalizations of equality are normally symmetric. For example, the relation R on the integers defined by (x, y) R iff x = y. Or the relation S on the real plane defined by ((x, y), (p, q)) S iff (x p) 2 + (y q) 2 25 (i.e. the two points are no more than 5 units apart). A relation R is antisymmetric if (y, x) and (x, y) are never both in R, except when x = y. This is typically true of order relations such as < and, or relations based on them. For example, the divides relation on the integers is antisymmetric because n m and m n are only both true when m = n. Formally, we can define them as: symmetric: x, y A, (x, y) R (y, x) R antisymmetric: x, y A with x y, (x, y) R (y, x) R Even if we restrict our attention to pairs whose two coordinates aren t the same, symmetric and antisymmetric still aren t opposites. Rather, they represent two pure patterns of what might happen with the reversed pairs. Most random relations and some real practical relations are mixed cases. Specifically a relation is neither symmetric nor antisymmetric if (x, y) and (y, x) are both in the relation for some values of x and y, but only one is in the set for other values. For example, the loves relation is neither symmetric nor antisymmetric for most large sets of people. There are some pairs of people who both love each other. But there are also some people who love another person, but their love isn t reciprocated. 6