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.

Slides:



Advertisements
Similar presentations
Functions Reading: Epp Chp 7.1, 7.2, 7.4
Advertisements

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.
The Engineering Design of Systems: Models and Methods
Discrete Mathematics Lecture # 16 Inverse of Relations.
Discrete Structures Chapter 5 Relations and Functions Nurul Amelina Nasharuddin Multimedia Department.
Theory and Applications
Functions Goals Introduce the concept of function Introduce injective, surjective, & bijective functions.
Discrete Mathematics Lecture#11.
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.
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.
CS355 - Theory of Computation Lecture 2: Mathematical Preliminaries.
Logics for Data and Knowledge Representation Introduction to Algebra Chiara Ghidini, Luciano Serafini, Fausto Giunchiglia and Vincenzo Maltese.
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.
Relations (1) Rosen 6 th ed., ch. 8. Binary Relations Let A, B be any two sets. A binary relation R from A to B, written (with signature) R:A↔B, is a.
Functions. Copyright © Peter Cappello2 Definition Let D and C be nonempty sets. A function f from D to C, for each element d  D, assigns exactly 1 element.
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
Unit Unit 04 Relations IT DisiciplineITD1111 Discrete Mathematics & Statistics STDTLP1 Unit 4 Relations.
Discrete Math for CS Binary Relation: A binary relation between sets A and B is a subset of the Cartesian Product A x B. If A = B we say that the relation.
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.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Copyright  The McGraw-Hill Companies, Inc. Permission required for reproduction.
Relations Relations between sets are like functions, but with a more general definition (given later). presentations: a set, a binary matrix, a graph…
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.
1.4 Sets Definition 1. A set is a group of objects . The objects in a set are called the elements, or members, of the set. Example 2 The set of positive.
Functions Reading: Chapter 6 (94 – 107) from the text book 1.
Basic Structures: Sets, Functions, Sequences, and Sums CSC-2259 Discrete Structures Konstantin Busch - LSU1.
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.
Discrete Mathematics Relation.
11 DISCRETE STRUCTURES DISCRETE STRUCTURES UNIT 5 SSK3003 DR. ALI MAMAT 1.
11 DISCRETE STRUCTURES DISCRETE STRUCTURES UNIT 5 SSK3003 DR. ALI MAMAT 1.
Relations and their Properties
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.
Sets and Subsets Set A set is a collection of well-defined objects (elements/members). The elements of the set are said to belong to (or be contained in)
CS 103 Discrete Structures Lecture 19 Relations. Chapter 9.
Discrete Mathematics Lecture # 15 Types of Relations (contd.)
Basic Structures: Sets, Functions, Sequences, and Sums.
Relation. Combining Relations Because relations from A to B are subsets of A x B, two relations from A to B can be combined in any way two sets can be.
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
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.
Unit II Discrete Structures Relations and Functions SE (Comp.Engg.)
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.
Copyright © Cengage Learning. All rights reserved. CHAPTER 8 RELATIONS.
RelationsCSCE 235, Spring Introduction A relation between elements of two sets is a subset of their Cartesian products (set of all ordered pairs.
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.
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 CSRU1400 Spring 2008Ellen Zhang 1 CISC1400, Fall 2010 Ellen Zhang.
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.
Discrete Mathematics Lecture # 17 Function. Relations and Functions  A function F from a set X to a set Y is a relation from X to Y that satisfies the.
“It is impossible to define every concept.” For example a “set” can not be defined. But Here are a list of things we shall simply assume about sets. A.
Binary Relation: A binary relation between sets A and B is a subset of the Cartesian Product A x B. If A = B we say that the relation is a relation on.
Relations and Their Properties
Chapter 5 Relations and Operations
Unit-III Algebraic Structures
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,
CS201: Data Structures and Discrete Mathematics I
Relations and Their Properties
Introduction to Relations and Functions
REVISION Relation. REVISION Relation Introduction to Relations and Functions.
Lecture # 16 Inverse of Relations
Presentation transcript:

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 as the first element and the other as the second element. An ordered pair is denoted by (a, b) Two ordered pairs (a, b) and (c, d) are equal if and only if a = c and b = d

ORDERED PAIRS AND PRODUCT SETS Example 1: The ordered pairs (2, 3) and (3, 2) are different. Example 2: The set {2, 3} is not an ordered pair since the elements 2 and 3 are not distinguished in a set. Example 3: Ordered pairs can have the same first and second elements such as (1, 1), and (4, 4)

ORDERED PAIRS AND PRODUCT SETS The set of all ordered pairs (a, b), where a € A and b € B, is called the Cartesian Product, or simply the product set, of the two sets. Cartesian Product of set A and set B is denoted by

ORDERED PAIRS AND PRODUCT SETS Example : Let A = {1, 2, 3} and B = {a, b} The product set is: Example : Let W = {x, y} Then W*W = {(x, x), (x, y), (y, x), (y, y)} Theorem : Let A and B be sets. If |A| = n, and |B| = m, then

SOME SPECIAL SETS Ø denotes the “null” or “empty” set Z denotes the set of integers, i.e. Q denotes the rational numbers. The rational numbers are those real numbers that can be expressed as the ratio of two integers. denotes the irrational numbers. A number that is not rational is irrational. N denotes the natural numbers. N = {1, 2, 3, 4, 5,...} R denotes the real numbers. Real numbers are the rational and irrational numbers.

DEFINITION OF RELATION A binary relation between sets A and B is a subset of. That is, a binary relation is a collection of ordered pairs from If A and B are equal, we refer to the relation as a relation on the set A.

DEFINITION OF RELATION Example : Let A = {1, 2, 3} and B = {a, b} Define some relations between A and B

DEFINITION OF RELATION The domain of a relation R is the set of all first elements of the ordered pairs that belong to R. The range of R is the set of second elements of the ordered pairs that belong to R.

DEFINITION OF RELATION Example : Let A = {1, 2, 3}, and let R be the relation on A defined by R={(1,3),(2,3),(2,2)} The domain of R is {1, 2} The range of R is {2, 3}

REPRESENTING RELATIONS Relations can be represented by listing the elements, or they can be represented graphically, by using pictures, or by using a matrix

PICTORIAL REPRESENTATION OF RELATIONS Example : Let R be a relation from A = {1, 2, 3} to B = {a, b} where

GRAPHICAL REPRESENTATION OF RELATIONS Another way of picturing a relation when it is from a finite set to itself is to write down the elements of the set and then draw an arrow from an element x to an element y whenever x is related to y. This type of diagram is called a directed graph of the relation.

GRAPHICAL REPRESENTATION OF RELATIONS Example :The directed graph of R = {(1, 2), (2, 2), (2, 4), (3, 2), (3, 4), (4, 1), (4,3)} on the set A = {1, 2, 3, 4} is:

GRAPHICAL REPRESENTATION OF RELATIONS We will use the following graphical representation to represent a relation. Example :Let A = {1, 2, 3}, and let R be the relation on A defined as R = {(1, 2), (2, 1), (2, 3), (3, 1), (3, 3)}

MATRIX REPRESENTATION OF A RELATION The more commonly used representation of relations that is also more convenient for computations is using a matrix to represent a relation. Let A be a set with n elements, and let B be a set with m elements.

MATRIX REPRESENTATION OF A RELATION Let R be a relation between A and B. Define the matrix M by for i = 1,..., n and j = 1,..., m. M is called the logical matrix for R.

MATRIX REPRESENTATION OF A RELATION Example : Let A be the set, and let B be the set Let R be the relation between A and B R = {(1, 1), (1, 2), (2, 1), (3, 2)} Write the matrix representing R. Since |A| = 3 and |B| = 2, the matrix representing R must have three rows and two columns. In row 2, column 2, for instance, the entry will be false since (2, 2) is not an element of R, i.e.

PROPERTIES OF RELATIONS Relations on a set can be classified according to certain properties. Let R be a relation on a set A. We say that R is reflexive if We say that R is symmetric if We say that R is transitive if

REFLEXIVE Let R be a subset of. Then R is called a reflexive relation if, Example : The directed graph of every reflexive relation includes an arrow from every point to the point itself, i.e

REFLEXIVE Example : Let V = {1, 2, 3, 4} and R = {(1, 1), (2, 4), (3, 3), (4, 1), (4, 4)} Then R is not a reflexive relation since (2, 2) does not belong to R. All ordered pairs (a, a) must belong to R in order for R to be reflexive.

SYMMETRIC Let R be a subset of, then R is called a symmetric relation if Example: The reason for the name of the symmetric property can be seen in the matrices below. Notice that each of the matrix representations for the symmetric relations are symmetric with respect to the main diagonal.

SYMMETRIC Directed graph representations of symmetric relations are also readily recognized because for every arrow from a to b there must also be an arrow from b to a. Example : Let S = {1, 2, 3, 4}, and let R = {(1, 3), (4, 2), (2, 4), (2, 3), (3, 1)} Then R is not a symmetric relation since but

TRANSITIVE A relation R in a set A is called a transitive relation if and Note that it is not easy to determine if a relation is transitive from either the matrix or the graph representation. Example: R= { (1,1),(1,3),(3,2),(1,2)} on S3 is transitive

EQUIVALENCE RELATIONS A relation ~ on a set S is called an equivalence relation if it has the following three properties: (1) Reflexive property (2) Symmetric property (3) Transitive property A relation is an equivalence relation if it is reflexive, symmetric, and transitive.

ANTISYMMETRIC We say that R is anti-symmetric if for all (a,b) belongs to R and ( b,a) belongs to R then a = b Do not confuse the anti-symmetric property with the absence of the symmetric property either. There are also relations that are neither symmetric nor anti- symmetric. Example: R={(1,1),(1,2),(3,3),(3,2)} on S3 is Antisymmetric.

ASYMMETRIC We say that R is asymmetric if for all (a,b ) belongs to R and ( b, a) doesn't belongs to R. Example : R={(1,1),(1,2),(3,3),(3,2)} on S3 is not asymmetric because (1,1) and (3,3) belongs to R Example: R = {(1,2),(2,3),(1,3)} on S3 is asymmetric.

IRREFLEXIVE We say that a relation R on a set A is irreflexive if for all ‘a’ belongs to A then (a, a) doesn't belongs to A. Do not confuse the irreflexive property with the absence of the reflexive property. There are relations that are neither reflexive nor irreflexive. Example: R = {(1,2),(1,3),(2,3),(3,1)} on S3 is irreflexive.

UNIVERSAL RELATIONS/EMPTY RELATIONS Let A be any set then is known as the universal relation. Let A be any set, then Ø is know as the empty relation

INVERSE RELATIONS Every relation R between sets A and B is a subset of We can reverse the roles of A and B to obtain a relation between B and A called the inverse relation of R. The inverse relation of R, denoted, is the relation between B and A given by Example: R = {(1,2),(1,3),(2,3),(3,1)} on S3,then = {(2,1),(3,1),(3,2),(1,3)}.

COMPOSITE RELATIONS Let R be a relation between sets A and B, and let S be a relation between B and C. The composition of R and S is the relation between A and C, denoted and is given by: ={(x, z): x € A, z € C ⁆ y € B (x, y)€ R and (y,z)€ S}

COMPOSITE RELATIONS Example : Graphically represent a composite relation. One can view the composite relation as a means of linking elements of A to elements of C by using elements of B as intermediate points

INTRODUCTION TO FUNCTIONS A function is an association of exactly one object from one set (the range) with each object from another set (the domain). This means there must be at least one arrow leaving each point in the domain. Also that there can be no more than one arrow leaving each point in the domain

ELEMENTS OF A FUNCTION We write to indicate that f is a function from A to B. The set A is called the domain of f. The set B is called the co-domain of f. The range of f denoted by f [A], is the set of all images; that is, The pre-image or inverse image of a set B contained in the range of f is denoted by and is the subset of the domain whose members have images in B.

INJECTIONS Let be a function. The function f is called an injective function, or an injection, if implies x = y Graphically this means that if two arrows arrive at the same point in B, they must come from the same point in A, and therefore they are the same. An injective function is also called a one-to-one function, or a function

INJECTIONS Example : Graphically represent an injective function one-to-one function

SURJECTIONS The function f is called a surjective function, or a surjection, if for each Graphically this means there must be an arrow arriving at each point of B. A surjective function is also called an onto function.

SURJECTIONS Example : Graphically represent a surjective function onto function

BIJECTIONS A function can also be neither 1 -1 nor onto, or it can be both 1 -1 and onto. If a function is both and onto it is called a bijection or bijective function.

BIJECTIONS Example : Graphically represent a bijective function or

BIJECTIONS Example : Graphically represent a function that is neither nor onto or

Some Facts.. A graph of a function f is iff every horizontal line intersects the graph in at most one point. A graph of a function f is onto iff every horizontal line intersects the graph in at least one point. The codomain and the range are equivalent iff the function is onto.

COMPOSITE FUNCTIONS As functions are subsets of relations, the composition of a function is the same as for relations.The composition of two functions f and g is denoted by f o g(x). Example : If f(x)=2x +3 and g(x) = x+2 find fog(x).

INVERTABLE FUNCTIONS Any function f has an inverse relation, The inverse relation does not need to be a function. If the inverse relation of a function is a function, we say that the function is invertible. Steps to find the inverse of any function y = f(x) 1.Find the value of x in terms of y. 2.Interchange x and y. 3.The result of step 2 will be the inverse of the given function Example: Find the inverse of the function f(x) = 4x – 1

The End