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,

Slides:



Advertisements
Similar presentations
1.6 Functions. Chapter 1, section 6 Functions notation: f: A B x in A, y in B, f(x) = y. concepts: –domain of f, –codomain of f, –range of f, –f maps.
Advertisements

Discrete Mathematics Lecture # 16 Inverse of Relations.
Functions Section 2.3 of Rosen Fall 2008
Discrete Structures Chapter 5 Relations and Functions Nurul Amelina Nasharuddin Multimedia Department.
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,
Functions.
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.
Sets Set Operations Functions. 1. Sets 1.1 Introduction and Notation 1.2 Cardinality 1.3 Power Set 1.4 Cartesian Products.
2.1 Sets 2.2 Set Operations 2.3 Functions ‒Functions ‒ Injections, Surjections and Bijections ‒ Inverse Functions ‒Composition 2.4 Sequences and Summations.
FUNCTION Discrete Mathematics Asst. Prof. Dr. Choopan Rattanapoka.
Foundations of Discrete Mathematics Chapter 3 By Dr. Dalia M. Gil, Ph.D.
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesFunctions.
Chapter 9. Section 9.1 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.
Functions Section 2.3 of Rosen Spring 2012 CSCE 235 Introduction to Discrete Structures Course web-page: cse.unl.edu/~cse235 Questions: Use Piazza.
Dr. Eng. Farag Elnagahy Office Phone: King ABDUL AZIZ University Faculty Of Computing and Information Technology CPCS 222.
1 Discrete Structures – CNS 2300 Text Discrete Mathematics and Its Applications (5 th Edition) Kenneth H. Rosen Chapter 1 The Foundations: Logic, Sets,
Chapter 1 SETS, FUNCTIONs, ELEMENTARY LOGIC & BOOLEAN ALGEBRAs BY: MISS FARAH ADIBAH ADNAN IMK.
Example Prove that: “IF 3n + 2 is odd, then n is odd” Proof by Contradiction: -p = 3n + 2 is odd, q = n is odd. -Assume that ~(p  q) is true OR -(p 
Functions Reading: Chapter 6 (94 – 107) from the text book 1.
Basic Structures: Functions Muhammad Arief download dari
CSE 2353 – October 1 st 2003 Functions. For Real Numbers F: R->R –f(x) = 7x + 5 –f(x) = sin(x)
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.
CompSci 102 Discrete Math for Computer Science January 31, 2012 Prof. Rodger Slides modified from Rosen AB a b c d x y z.
11 DISCRETE STRUCTURES DISCRETE STRUCTURES UNIT 5 SSK3003 DR. ALI MAMAT 1.
Unit II Discrete Structures Relations and Functions SE (Comp.Engg.)
CSC102 - Discrete Structures Functions
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.
FUNCTIONS COSC-1321 Discrete Structures 1. Function. Definition Let X and Y be sets. A function f from X to Y is a relation from X to Y with the property.
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.
Discrete Mathematics 3. MATRICES, RELATIONS, AND FUNCTIONS Lecture 6 Dr.-Ing. Erwin Sitompul
1 Lecture 5 Functions. 2 Functions in real applications Curve of a bridge can be described by a function Converting Celsius to Fahrenheit.
Section 2.3. Section Summary  Definition of a Function. o Domain, Cdomain o Image, Preimage  One-to-one (Injection), onto (Surjection), Bijection 
FUNCTIONS.
Functions Section 2.3.
Relations, Functions, and Matrices
Unit-III Algebraic Structures
Applied Discrete Mathematics Week 2: Functions and Sequences
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.
Functions.
Chapter 2 Sets and Functions.
Relation and function.
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.
Functions Section 2.3.
Chapter 2 Sets Homework 3 Given U = { 1, 2, 3, 4, 5, 6, 7, 8, 9 } as a set universe and the sets : A = { 1, 2, 3, 4, 5 }, B = { 4, 5, 6, 7 }, C = { 5,
CS201: Data Structures and Discrete Mathematics I
Functions.
CS100: Discrete structures
… and the following mathematical appetizer is about…
Functions CS 202 Epp section 7.1.
Relations and Their Properties
8.1 Relations and Their Properties
CS 220: Discrete Structures and their Applications
Functions.
Relations and their Properties
Introduction to Relations and Functions
Ch 5 Functions Chapter 5: Functions
… and the following mathematical appetizer is about…
Functions Rosen 6th ed., §2.3.
Properties of Functions
Equivalence Relations
Equivalence Relations
Lecture # 18 Types of Functions
Functions Section 2.3.
REVISION Relation. REVISION Relation Introduction to Relations and Functions.
Copyright © Zeph Grunschlag,
Lecture # 16 Inverse of Relations
Presentation transcript:

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, transitive, symmetric, and/or anti-symmetric: R = { (2,2),(2,3),(2,4),(3,2),(3,3),(3,4) } S = { (1,1),(1,2),(2,1),(2,2),(3,3),(4,4) } T = { (1,2),(2,3),(3,4) } Represent the relation R, S, and T using matrices and digraphs.

Solution to Homework 4 Given A = { 1,2,3,4 }, then: Chapter 3 Relation and Function Solution to Homework 4 Given A = { 1,2,3,4 }, then: R = { (2,2),(2,3),(2,4),(3,2),(3,3),(3,4) } Not reflexive, because (1,1) and (4,4) are not members of R Not irreflexive, because (2,2) and (3,3) are members of R Transitive, proven by (2,2) (2,3) (2,3) (2,2) (2,4) (2,4) (2,3) (3,2) (2,2) (2,3) (3,3) (2,3) (2,3) (3,4) (2,4) (3,2) (2,2) (3,2) a.s.o. Not symmetric, because {(4,2),(4,3)}  R. Not anti symmetric, because there exists (2,3) and (3,2) as members of R, while 2  3.

Solution to Homework 4 Given A = { 1,2,3,4 }, then: Chapter 3 Relation and Function Solution to Homework 4 Given A = { 1,2,3,4 }, then: S = {(1,1),(1,2),(2,1),(2,2),(3,3),(4,4)} is Reflexive, because (a,a) is a member of R for each a  A Automatically not irreflexive, Transitive, proven by (1,1) (1,2) (1,2) (1,2) (2,2) (1,2) Symmetric, because if (a,b)  S then (b,a)  S, too Not anti symmetric, because there exists (1,2) and (2,1) as members of R while 1  2

Solution to Homework 4 Given A = { 1,2,3,4 }, then: Chapter 3 Relation and Function Solution to Homework 4 Given A = { 1,2,3,4 }, then: T = {(1,2),(2,3),(3,4)} is Not reflexive, because {(1,1),(2,2),(3,3),(4,4)}  R Irreflexive, because there is no (a,a)  R for any a  A Not transitive, because (1,3) and (2,4) are not members of R Not symmetric, because (2,1), (3,2), and (4,3)  R Anti symmetric, because the definition of the property is not violated

Solution to Homework 4 Representation in matrices and digraphs: Chapter 3 Relation and Function Solution to Homework 4 Representation in matrices and digraphs: R = { (2,2),(2,3),(2,4),(3,2),(3,3),(3,4) } S = { (1,1),(1,2),(2,1),(2,2),(3,3),(4,4) } T = { (1,2),(2,3),(3,4) } T R S

Chapter 3 Relation and Function Inverse of Relations If R is a relation from set A to set B, then the inverse of relation R, denoted with R–1, is the relation from set B to set A defined by: R–1 = { (b,a) | (a,b)  R }. Example: Suppose P = { 2,3,4 } Q = { 2,4,8,9,15 }. If the relation R from P to Q is defined by: (p,q)  R if p divides q without remainder, then the members of the relation can be obtained as: R = { (2,2),(2,4),(2,8),(3,9),(3,15),(4,4),(4,8) }. R–1, the inverse of R, is a relation from Q to P with: (q,p)  R–1 if q is a multiplication of p. It can be obtained that: R–1 = { (2,2),(4,2),(8,2),(9,3),(15,3),(4,4),(8,4) }.

Chapter 3 Relation and Function Combining Relations A binary relation is composed of a set of relation pairs. Thus, set operations such as intersection, union, difference, and symmetric difference between two relations or more are also applicable on binary relations. If both R1 and R2 are relations from set A to set B, then R1  R2, R1  R2, R1 – R2, and R1  R2 are also relations from set A to set B.

Chapter 3 Relation and Function Combining Relations Example: Given the sets A = {a,b,c} and B = {a,b,c,d}, Relation R1 = {(a,a),(b,b),(c,c)}, Relation R2 = {(a,a),(a,b),(a,c),(a,d)}, then R1  R2 = {(a,a)} R1  R2 = {(a,a),(b,b),(c,c),(a,b),(a,c),(a,d)} R1  R2 = {(b,b),(c,c)} R2  R1 = {(a,b),(a,c),(a,d)} R1  R2 = {(b,b),(c,c),(a,b),(a,c),(a,d)}.

Composition of Relations Chapter 3 Relation and Function Composition of Relations Suppose R is a relation from set A to set B, and S is a relation from set B to set C, then composition of relations R and S, denoted with S ○ R, is a relation from set A to set C that is defined by: S ○ R = {(a,c)a  A, c  C, and for some b  B, (a, b)  R and (b, c)  S. Example: Given that R = { (1,2),(1,6),(2,4),(3,4),(3,6),(3,8) } is a relation from set {1,2,3} to set {2,4,6,8}; and S = { (2,u),(4,s),(4,t),(6,t),(8,u) } is a relation from set {2,4,6,8} to set {s,t,u}. then the composition of relations R and S is S ○ R = { (1,u),(1,t),(2,s),(2,t),(3,s),(3,t),(3,u) }.

Composition of Relations Chapter 3 Relation and Function Composition of Relations Composition of relations R and S can also be represented by using an arrow diagram: R = { (1,2),(1,6),(2,4),(3,4),(3,6),(3,8) } S = { (2,u),(4,s),(4,t),(6,t),(8,u) } S ○ R = { (1,u),(1,t),(2,s),(2,t),(3,s),(3,t),(3,u) }

Chapter 3 Relation and Function Functions Suppose A and B are sets, then a binary relation f from A to B is called a function if every member in A is related with exactly one member in B. The notation of a function is written as f : A  B. Pronounced: “f maps or associates A to B.” A is called domain of f and B is called co-domain of f. Other terms for “function” are mapping and transformation. We write f(a) = b if the function maps or associates a  A with b  B.

Chapter 3 Relation and Function Functions If f(a) = b, then b is called the image of a and a is called the pre-image of b. A set that contains all mapping values of f is called the co-domain of f. Note that the range of f is an improper subset of the co-domain B. f maps A to B A B f Co-domain Domain f(4.3) 4.3 4 4.3 is the pre-image of 4 4 is the image of 4.3

Functions A function is a relation with special properties: Chapter 3 Relation and Function Functions A function is a relation with special properties: Every member of set A must be utilized/employed by the procedure or rule that defines the function. The sentence “every member in A is related with exactly one member in B” has the meaning that if (a,b)  f and (a,c)  f, then b = c. Or in other words, if b = f(a) and c = f(a), then b = c.

Chapter 3 Relation and Function Functions Example: Suppose A = {1,2,3} and B = {u,v,w}, then the following relations: f = {(1,u),(2,v),(3,w)} is a function from A to B. Here, f(1) = u, f(2) = v, and f(3) = w. The domain of f is A and the co-domain of f is B. The range of f are {u,v,w}, which in this case is equivalent to set B. f = {(1,u),(2,u),(3,v)} is a function from A to B, although u becomes the image of two members of A. The domain of f is A and the co-domain of f is B. But, the range of f is {u,v} only, a subset of B.

Chapter 3 Relation and Function Functions Example: Suppose A = {1,2,3} and B = {u,v,w}, then the following relations: f = {(1,u),(2,v)} is not a function from A to B, because not all members of A is associated to any members of B. f = {(1,u),(1,v),(2,v),(3,w)} is not a function from A to B, because 1 is mapped to two members of B, which are u and v.

Chapter 3 Relation and Function Injective Function The function f that maps elements of A to elements of B is called an injective function if all members of A have distinct image in B. In other words, if f(x) = f(y) then x = y for all x and y in the domain of f. Injective function is also called one-to-one function.

Chapter 3 Relation and Function Injective Function Example: Suppose A = {1,2,3} and B = {u,v,w,x}, then the following relations: f = {(1,w),(2,u),(3,v)} is an injective function. All members of A have distinct image on B. f = {(1,u),(2,u),(3,v)} is not an injective function because f(1) = f(2) = u. Example: Let g: Z  Z, where g(x) = 2x–1. Is g injective? Example: Let h: Z  Z, where h(x) = x2 + 8x – 6. Is h injective?

Chapter 3 Relation and Function Surjective Function The function f that maps elements of A to elements of B is called a surjective function if every member B is the image of one or more members of A. In other words, all members of B become the range of f. The function f is called “the function on B.” Surjective function is also called on-to function.

Chapter 3 Relation and Function Surjective Function Example: Suppose A = {1,2,3} and B = {u,v,w}, then the following relations: f = {(1,u),(2,u),(3,v)} is not a surjective function because w is not included in the range of f. f = {(1,w),(2,u),(3,v)} is a surjective function because all members of B are included in the range of f. Example: For A = {0,1,2,3,…,9} and B = {0,1,2}, determine whether h: A  B, with h(x) = x mod 3 is a surjective function or not. (Hint: mod give the remainder after division. 24 mod 3 = 0, 18 mod 5 = 3).

Chapter 3 Relation and Function Bijective Function The function f that maps elements of A to elements of B is called a one-to-one correspondence or bijective if f is an injective function and a surjective function, simultaneously. Example: Suppose A = {1,2,3} and B = {u,v,w}, then the relation f = {(1,w),(2,u),(3,v)} is a bijective function, because f is an injective and also surjective function at the same time.

Exercise Injective, not surjective Not injective, surjective Chapter 3 Relation and Function Exercise Injective, not surjective Not injective, surjective Not injective, not surjective Not a function

Exercise Example: Let g: Z  Z, where g(x) = 2x. Is g bijective? Chapter 3 Relation and Function Exercise Example: Let g: Z  Z, where g(x) = 2x. Is g bijective? Example: Create a bijective function with domain and range of integers, f: Z  Z.

Chapter 3 Relation and Function Inverse of a Function Inverse of a function f that maps elements of A to elements of B can be obtained if and only if f bijective, that is there is a one-to-one correspondence from A to B. Inverse of function f is denoted by f –1, which is a bijective function from B to A. Suppose a  A and b  B, if f(a) = b then f –1(b) = a. A one-to-one correspondence is also called an invertible function, because its inverse can be defined. A function is said to be not invertible if it is not a bijective function. In this case, the inverse does not exist.

Chapter 3 Relation and Function Inverse of a Function Example: Suppose A = {1,2,3} and B = {u,v,w}, then the following relations: f = {(1,u),(2,u),(3,v)} is not a one-to-one correspondence. f –1= {(u,1),(u,2),(v,3)} is not a function at all  the inverse cannot be defined. f = {(1,w),(2,u),(3,v)} is a one-to-one correspondence. f –1= {(w,1),(u,2),(v,3)} is a function  the inverse can be defined  f is an invertible function

Composition of Functions Chapter 3 Relation and Function Composition of Functions Suppose f is a function that builds a map from set A to set B, and likewise g from set B to set C. The composition of f and g, denoted as g ○ f, is function from A to C that is defined by: (g ○ f)(a) = g(f(a)) Example: Given function f = {(1,u),(2,u),(3,v)} that builds a map from A = {1,2,3} to B = {u,v,w}, and function g = {(u,y),(v,x),(w,z)} that builds a map from B = {u,v,w} to C = {x,y,z}. Then the composition of A to C is: g ○ f = {(1, y), (2, y), (3, x)}

Composition of Functions Chapter 3 Relation and Function Composition of Functions Example: Suppose that the functions are f(x) = x – 1 and g(x) = x2 + 1. Determine f ○ g and g ○ f. Solution: (f○g)(x) = f(g(x)) = f(x2 + 1) = (x2 + 1) – 1 = x2 (g○f)(x) = g(f(x)) = g(x – 1) = (x –1)2 + 1 = x2 – 2x + 2

Several Special Functions Chapter 3 Relation and Function Several Special Functions Floor Function and Ceiling Function Suppose x is a real number, whose value is between two integers. floor of x, denoted as x, yields the greatest integer which is less than or equal to x. ceiling of x, denoted as x, yields the smallest integer which is greater than or equal to x.

Several Special Functions Chapter 3 Relation and Function Several Special Functions Example: Some examples for the values of floor function and ceiling function: 3.5 = 3 3.5 = 4 0.45 = 0 0.45 = 1 4.8 = 4 4.8 = 5 – 0.5 = – 1 – 0.5 = 0 –3.75 = – 4 –3.75 = – 3 How to make a round function, such that round(4.2) = 4, round(7.52) = 8?

Several Special Functions Chapter 3 Relation and Function Several Special Functions Modulo Function Suppose a is an arbitrary integer and m is an arbitrary positive integer, then a mod m yields the remaining of the division if a is divided by m a mod m = r such that a = mq + r, where q is an arbitrary integer and 0  r < m The value of r can also be found using the formula of: r = a – mq where q = a/m

Several Special Functions Chapter 3 Relation and Function Several Special Functions Example: Some examples for the values of modulo function: 25 mod 7 = 4, 25/7 = 3 and 25 – 73 = 4 15 mod 4 = 3, 15/4 = 3 and 15 – 43 = 3 3612 mod 45 = 12, 3612/45 = 80 and 3612 – 4580 = 12 0 mod 5 = 0, 0/5 = 0 and 0 – 50 = 0 –25 mod 7 = 3, –25/7 = –4 and –25 – 7(–4) = 3

Chapter 3 Relation and Function Exercise Problems Determine whether the following relations are injective, surjective, bijective, or neither. 1 2 3 4 a b c 1 2 3 4 a b c d 1 2 3 4 a b c (a) (b) (c) 1 2 3 a b c d 1 2 3 4 a b c d (d) (e)

Chapter 3 Relation and Function Exercise Problems Let f:RR and g:RR be defined by f(x) = 2x + 1 and g(x) = x2 – 2. Find the formula for the composition functions: f ○ f ○ g g ○ g ○ f 33