Introduction to Relations and Functions

Slides:



Advertisements
Similar presentations
The Engineering Design of Systems: Models and Methods
Advertisements

CSE115/ENGR160 Discrete Mathematics 04/24/12 Ming-Hsuan Yang UC Merced 1.
Discrete Structures Chapter 5 Relations and Functions Nurul Amelina Nasharuddin Multimedia Department.
Discrete Math for CS Chapter 5: Functions. Discrete Math for CS New Relation Operations: Given R, a relation on A x B, we define the inverse relation,
1 Section 1.8 Functions. 2 Loose Definition Mapping of each element of one set onto some element of another set –each element of 1st set must map to something,
1 Section 7.1 Relations and their properties. 2 Binary relation A binary relation is a set of ordered pairs that expresses a relationship between elements.
Chapter 7 Functions Dr. Curry Guinn. Outline of Today Section 7.1: Functions Defined on General Sets Section 7.2: One-to-One and Onto Section 7.3: The.
Section 1.8: Functions A function is a mapping from one set to another that satisfies certain properties. We will first introduce the notion of a mapping.
Relation. Relations Recall the definition of the Cartesian (Cross) Product: The Cartesian Product of sets A and B, A x B, is the set A x B = { : x  A.
Unit Unit 04 Relations IT DisiciplineITD1111 Discrete Mathematics & Statistics STDTLP1 Unit 4 Relations.
R. Johnsonbaugh, Discrete Mathematics 5 th edition, 2001 Chapter 2 The Language of Mathematics.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Copyright  The McGraw-Hill Companies, Inc. Permission required for reproduction.
Chapter 1 SETS, FUNCTIONs, ELEMENTARY LOGIC & BOOLEAN ALGEBRAs BY: MISS FARAH ADIBAH ADNAN IMK.
Basic Structures: Functions Muhammad Arief download dari
Sets Define sets in 2 ways  Enumeration  Set comprehension (predicate on membership), e.g., {n | n  N   k  k  N  n = 10  k  0  n  50} the set.
Agenda Week 10 Lecture coverage: –Functions –Types of Function –Composite function –Inverse of a function.
Language: Set of Strings
Discrete Mathematics Relation.
CHAPTER 3 FUZZY RELATION and COMPOSITION. 3.1 Crisp relation Product set Definition (Product set) Let A and B be two non-empty sets, the product.
CS 103 Discrete Structures Lecture 19 Relations. Chapter 9.
Basic Structures: Sets, Functions, Sequences, and Sums.
1 Discrete and Combinatorial Mathematics R. P. Grimaldi, 5 th edition, 2004 Chapter 5 Relations and Functions.
Sets Definition: A set is an unordered collection of objects, called elements or members of the set. A set is said to contain its elements. We write a.
Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A.
RelationsCSCE 235, Spring Introduction A relation between elements of two sets is a subset of their Cartesian products (set of all ordered pairs.
Relations and Functions ORDERED PAIRS AND CARTESIAN PRODUCT An ordered pair consists of two elements, say a and b, in which one of them, say a is designated.
Binary Relations Definition: A binary relation R from a set A to a set B is a subset R ⊆ A × B. Example: Let A = { 0, 1,2 } and B = {a,b} {( 0, a), (
FUNCTIONS.
Section 9.1. Section Summary Relations and Functions Properties of Relations Reflexive Relations Symmetric and Antisymmetric Relations Transitive Relations.
Lecture 7: Relations Dr Andrew Purkiss-Trew Cancer Research UK Mathematics for Computing.
Discrete Mathematical
Relations and Their Properties
Citra Noviyasari, S.Si, MT
Chapter 5 Relations and Operations
Functions Section 2.3.
Relations.
Cartesian product Given two sets A, B we define their Cartesian product is the set of all the pairs whose first element is in A and second in B. Note that.
Chapter 2 Sets and Functions.
Relation and function.
Chapter 3 Relation and Function Homework 4 For each of the following relations on set A = { 1,2,3,4 }, check each of them whether they are reflexive, irreflexive,
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 2 Sets Slides are adopted from “Discrete.
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 9 Relations Slides are adopted from.
… and the following mathematical appetizer is about…
Functions.
Applied Discrete Mathematics Week 9: Equivalence Relations
Functions Section 2.3.
CS201: Data Structures and Discrete Mathematics I
Discrete Math (2) Haiming Chen Associate Professor, PhD
Functions.
CSE15 Discrete Mathematics 02/27/17
CS100: Discrete structures
… and the following mathematical appetizer is about…
Relations and Their Properties
8.1 Relations and Their Properties
CSE15 Discrete Mathematics 04/26/17
Sungho Kang Yonsei University
Mathematical Background 1
Mathematical Background 1
Relations and their Properties
Ch 5 Functions Chapter 5: Functions
… and the following mathematical appetizer is about…
Functions Rosen 6th ed., §2.3.
Functions Rosen 2.3, 2.5 f( ) = A B Lecture 5: Oct 1, 2.
Properties of Relations
Mathematical Background
Discrete Math (2) Haiming Chen Associate Professor, PhD
Lecture # 18 Types of Functions
Functions Section 2.3.
REVISION Relation. REVISION Relation Introduction to Relations and Functions.
Agenda Lecture Content: Relations (Relasi)
Presentation transcript:

Introduction to Relations and Functions

Introduction to Relations Relations can be used to solve problems such as determining which pairs of cities are linked by airline flights in a network, or producing a useful way to store information in computer databases. Relation

Introduction to Relations Relationships between elements of sets occur in many contexts. Example: An airline services the five cities Senai, Kuala Lumpur, Penang, Kota Kinabalu, Kuching. Relation

Relation

Introduction to Relations Relationships between elements of sets are represented using a structure called relation. Definition: Let A and B be sets. A relation R from A to B (a binary relation) is a subset of Relation

Introduction to Relations Definition: Let A and B be sets. The Cartesian product of A and B, is defined by e.g. If A={1,2} and B={a,b,c}, then Relation

Introduction to Relations Definition: Let A and B be non-empty sets. A relation R from A and B is a subset of A x B. We say that a is related to b by R a R b Relation

Relations and Their Properties Use ordered pairs (a, b) to represent the relationship between elements of two sets. Example Let A be the set of IT students in FTMM Let B be the set of courses, Let R be the relation that consists of those pairs (a, b) where a is a student enrolled in course b. Then we may have (Ahmad, BIT1113), (Lim, BIT3143) belonging to R. Relation

If R={(0,a), (0,b), (1,a), (2,b)}, then 0 is related to a Let A={0,1,2} and B={a,b}. If R={(0,a), (0,b), (1,a), (2,b)}, then 0 is related to a but 1 is not related to b. Relation

Relations can be represented graphically and in tabular form R={(0,a), (0,b), (1,a), (2,b)} Graphical method Tabular form 1 2 a b Relation

Relations on a Set Relations from a set A to itself are of special interest. Definition: A relation on a set A is a relation from A to A. Relation

Example Let A = {1, 2, 3, 4 }. Which ordered pairs are in the relation R ={(a, b) : a divides b } ? R = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 4), (3, 3), (4, 4)} Relation

Which of the following relations contain the ordered pairs (1, 1), (1, 2), (2, 1), (1, -1) or (2, 2) ? R1 = {(a, b) : a < b } {(1, 1), (1, 2), (2, 2)} R2 = {(a, b) : a > b } {(2, 1), (1, - 1)} R3 = {(a, b) : a = b or a = -b} {(1, 1), (1, -1), (2, 2)} Relation

Which of the following relations contain the ordered pairs (1, 1), (1, 2), (2, 1), (1, -1) or (2, 2) ? R4 = {(a, b) : a = b } {(1, 1), (2, 2)} R5 = {(a, b) : a = b + 1 } {(2, 1)} R6 = {(a, b) : a + b < 3 }. {(1, 1), (1, 2), (2, 1), (1, -1)} Relation

Combining Relations Two relations from A to B can be combined using the set operations of union , intersection  and complement \. Consider the following examples. Relation

Example Let R1 = {(1, 1), (2, 2), (3, 3)} and then : R1  R2 = {(1, 1), (1, 2), (1, 3), (1,4), (2, 2), (3, 3)} R1  R2 = {(1, 1)} R1 \ R2 = {(2, 2), (3, 3)} R2 \ R1 = {(1, 2), (1, 3), (1,4)} Relation

Representing Relations List its ordered pairs Graphical method Tabular form Use zero-one matrices Use directed graphs Relation

Relations using matrices Suppose that A = {1, 2, 3} and B ={1, 2}. Let R be the relation from A to B such that it contains (a, b) if a  A, b  B, and a > b. What is the matrix representing R ? Since R = {(2, 1), (3, 1), (3, 2)}, the matrix for R is : Relation

Relations using directed graphs 2 1 4 3 Relation

Properties of Binary Relations The most direct way to express a relationship between two sets was to use ordered pairs. For this reason, sets of ordered pairs are called binary relations. Relation

Reflexive Property of a Binary Relation Definition: A relation R on a set A is called reflexive if (a, a)  R for every element a  A. Relation

Not reflexive because 3  A but (3,3)  R1 Consider the following relations on {1, 2, 3, 4}. Which of these relations are reflexive? R1 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 4), (4, 1), (4, 4)} Not reflexive because 3  A but (3,3)  R1 R2 = {(1, 1), (1, 2), (2, 1)} Not reflexive because, say, 4  A but (4, 4)  R2 R3 = {(1, 1), (1, 2), (1, 4), (2, 1), (2, 2), (3, 3), (4, 1), (4, 4)} Reflexive Relation

R4 = {(2, 1), (3, 1), (3, 2), (4, 1), (4, 2), (4, 3)} Not reflexive - (1, 1) ? R5 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4),(3, 3), (3, 4), (4, 4)} Reflexive - Why ? R6 = {(3, 4)} Not Reflexive - Why ? Relation

Symmetric Property of a Binary Relation Definitions: A relation R on a set A is called symmetric if for all a, b  A, (a, b)  R implies (b, a)  R . Relation

Which of the relations are symmetric? Not symmetric - (3, 4) but no (4, 3) R2 = {(1, 1), (1, 2), (2, 1)} Symmetric Relation

R3 = {(1, 1), (1, 2), (1, 4), (2, 1), (2, 2), (3, 3), (4, 1), (4, 4)} Symmetric R4 = {(2, 1), (3, 1), (3, 2), (4, 1), (4, 2), (4, 3)} Not symmetric - (2, 1) but no (1, 2) Relation

Not symmetric - (1, 3) but no (3, 1) Relation

Transitive Property of a Binary Relation Definition: A relation R on a set A is called transitive if whenever (a, b)  R and (b, c)  R then (a, c)  R, for a, b, c  A. Relation

Which of the following relations are transitive? Not transitive - (3, 4) & (4, 1)  R1 but (3, 1)  R1 R2 = {(1, 1), (1, 2), (2, 1)} Not Transitive - (2, 1) & (1, 2)  R2 but (2, 2)  R2 Relation

R3 = {(1, 1), (1, 2), (1, 4), (2, 1), (2, 2), (3, 3), (4, 1), (4, 4)} Not transitive - (4, 1) & (1, 2)  R3 but (4, 2)  R3 R4 = {(2, 1), (3, 1), (3, 2), (4, 1), (4, 2), (4, 3)} Transitive Relation

R5 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4)} Transitive Relation

Equivalence Relation Definition: A relation R that is reflexive, symmetric and transitive on a set A is called equivalence relation Relation

Is relation R5 ia an equivalence relation on set A? Consider a set A={1, 2 , 3 , 4 , 5 } R5 = {(1, 1), (1, 3), (1, 5), (2, 2), (2, 4), (3, 1), (3, 3), (3, 5), (4, 2), (4, 4), (5, 1), (5, 3), (5, 5 )} Is relation R5 ia an equivalence relation on set A? Yes, R5 is an equivalence relation. Why ? Relation

Consider a set A={a , b , c, d,} R6 = {(a, a), (b, c), (c, b), (d, d)} Is relation R6 ia an equivalence relation on set A? No, R6 is an equivalence relation , Why ? Relation

Function A function assigns to each member of a set X exactly one member of a set Y. Let X and Y be the sets. A function from X to Y is a subset of Cartesian product X x Y having the property that for each xX, there is exactly one yY with (x,y)  f. We sometimes denote a function f from to Y as f: XY. Relation

Relation

Relation

Types of Functions One-to-one (Injective) Onto (Surjective) Both one-to-one and onto (Bijection) Relation

Each element in B can only have at most 1 arrow pointing to it. One-to-one (Injective) A function f from X to Y is said to be injective if for each yY, there is at most one xX with f(x)=y. Each element in B can only have at most 1 arrow pointing to it. Relation

Onto (Surjective) If f is a function from X to Y and the range of f is Y, then f is said to be onto Y, or surjective function. Each element in Y must has at least 1 arrow pointing to it. Relation

Bijection A function that is both one-to-one and onto is called bijection. If f is a bijection from a finite set X to a finite set Y, then |X| = |Y|, that is the sets have the same cardinality and are the same size Relation

Operation Sum (f + g)(x)=f(x) + g(x) Difference (f-g)(x) = f(x)-g(x) Product f(x) * g(x) = (f g)(x) Divide (f/g)=f(x)/g(x), Relation

Special Type of Function Identity function Identity function maps each element from A to A. Relation

Special Type of Function Inverse function An inverse function of f : A  B is f -1:B  A, given that f is a bijective function (onto and one-to-one). Note that not all functions have the inverse function. Relation

Special Type of Function Invertible function A function f: AB is said to be invertible if its inverse relation, f -1 , is also a function. Relation

Special Type of Function Composition function Relation