CSNB 143 Discrete Mathematical Structures

Slides:



Advertisements
Similar presentations
Lecture 15 Functions CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
Advertisements

(CSC 102) Lecture 21 Discrete Structures. Previous Lecture Summery  Sum/Difference of Two Functions  Equality of Two Functions  One-to-One Function.
Transitive Closure Theorem 1. Let R be a relation on a set A. Then R  is the transitive closure of R. the reachability relation R * of a relation R on.
Functions Section 2.3 of Rosen Fall 2008
Permutations and Inverses. Definition Let A be a set. If f : A  A is a 1-1 correspondence then f is called a permutation of A. Notation: S(A): the set.
CSE115/ENGR160 Discrete Mathematics 02/22/11 Ming-Hsuan Yang UC Merced 1.
Discrete Structures Chapter 5 Relations and Functions
CSE115/ENGR160 Discrete Mathematics 02/21/12
Functions Goals Introduce the concept of function Introduce injective, surjective, & bijective functions.
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,
Section 4.1 Finite Permutation Groups Permutation of a Set Let A be the set { 1, 2, …, n }. A permutation on A is a function f : A  A that is both one-to-one.
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.
Functions Definition A function from a set S to a set T is a rule that assigns to each element of S a unique element of T. We write f : S → T. Let S =
FUNCTION Discrete Mathematics Asst. Prof. Dr. Choopan Rattanapoka.
Mathematics. Session Set, Relation & Function Session - 3.
CSCI 115 Chapter 5 Functions. CSCI 115 §5.1 Functions.
Foundations of Discrete Mathematics Chapter 3 By Dr. Dalia M. Gil, Ph.D.
February 12, 2015Applied Discrete Mathematics Week 2: Functions and Sequences 1Exercises Question 1: Given a set A = {x, y, z} and a set B = {1, 2, 3,
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.
ICS 253: Discrete Structures I
6.3 Permutation groups and cyclic groups  Example: Consider the equilateral triangle with vertices 1 , 2 , and 3. Let l 1, l 2, and l 3 be the angle bisectors.
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesFunctions.
Chapter 2: Basic Structures: Sets, Functions, Sequences, and Sums (2)
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Copyright  The McGraw-Hill Companies, Inc. Permission required for reproduction.
Fall 2002CMSC Discrete Structures1 … and the following mathematical appetizer is about… Functions.
10/26/20151 … and the following mathematical appetizer is about… Functions.
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,
Functions1 Elementary Discrete Mathematics Jim Skon.
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.
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 
Chapter 9 Functions Let A and B be nonempty sets. A function f from A to B, written f: A  B is a relation from A to B with the property that every element.
Functions Reading: Chapter 6 (94 – 107) from the text book 1.
Basic Structures: Functions Muhammad Arief download dari
Chapter 5 – Relations and Functions. 5.1Cartesian Products and Relations Definition 5.1: For sets A, B  U, the Cartesian product, or cross product, of.
CompSci 102 Discrete Math for Computer Science January 31, 2012 Prof. Rodger Slides modified from Rosen AB a b c d x y z.
Functions Section 2.3. Section Summary Definition of a Function. – Domain, Cdomain – Image, Preimage Injection, Surjection, Bijection Inverse Function.
11 DISCRETE STRUCTURES DISCRETE STRUCTURES UNIT 5 SSK3003 DR. ALI MAMAT 1.
 R  A×B,R is a relation from A to B , DomR  A 。  (a,b)  R (a, c)  R  (a,b)  R (a, c)  R unless b=c  function  DomR=A , (everywhere)function.
11 DISCRETE STRUCTURES DISCRETE STRUCTURES UNIT 5 SSK3003 DR. ALI MAMAT 1.
Basic Structures: Sets, Functions, Sequences, and Sums.
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.
CSC102 - Discrete Structures Functions
SECTION 9 Orbits, Cycles, and the Alternating Groups Given a set A, a relation in A is defined by : For a, b  A, let a  b if and only if b =  n (a)
Section 3.2: Sequences and Summations. Def: A sequence is a function from a subset of the set of integers (usually the set of natural numbers) to a set.
Chapter 7 – Radical Equations and Inequalities 7.2 – Inverse Functions and Relations.
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.
Functions – Page 1CSCI 1900 – Discrete Structures CSCI 1900 Discrete Structures Functions Reading: Kolman, Section 5.1.
Functions CSRU1400 Spring 2008Ellen Zhang 1 CISC1400, Fall 2010 Ellen Zhang.
CSNB143 – Discrete Structure Topic 8 – Function. Learning Outcomes Students should be able to understand function and know how it maps. Students should.
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 
Chapter 2 1. Chapter Summary Sets The Language of Sets - Sec 2.1 – Lecture 8 Set Operations and Set Identities - Sec 2.2 – Lecture 9 Functions and sequences.
FUNCTIONS.
Prepared By Meri Dedania (AITS) Discrete Mathematics by Meri Dedania Assistant Professor MCA department Atmiya Institute of Technology & Science Yogidham.
“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.
Functions Goals Introduce the concept of function
Relations, Functions, and Matrices
Chapter 2 Sets and Functions.
CSNB 143 Discrete Mathematical Structures
6-7 Inverse Relations and Functions
Functions Section 2.3.
CS201: Data Structures and Discrete Mathematics I
CSE15 Discrete Mathematics 02/27/17
CS100: Discrete structures
Functions Rosen 2.3, 2.5 f( ) = A B Lecture 5: Oct 1, 2.
Functions Section 2.3.
Presentation transcript:

CSNB 143 Discrete Mathematical Structures Chapter 10 - Functions

OBJECTIVES Student should be able to know about function as a map that has images and values. Students should be able to understand function and know how it maps. Students should be able to identify different type of function and solve it.

Function Is a special relation. Let A and B be nonempty sets. A function f from A to B, denoted f : A  B is a relation from A to B such that for all a  Dom (f), f(a) contains just one element of B. If a is not in Dom (f), then f(a) = . The relation f can be described as the set of pairs {(a, f(a)) | a  Dom (f)} Functions are also called mappings or transformations since they can be geometrically viewed as rules that assign to each element a  A, the unique element f(a)  B.

The element a is called an argument of the function f and f(a) is called the value of the function for the argument a and is also referred to as the image of a under f. f . b = f(a) B a . A

Ex 1: Let A = {1, 2, 3, 4} and B = {a, b, c, d} and let f = {(1, a), (2, a), (3, d), (4, c)} We have f(1) = a f(2) = a f(3) = d f(4) = c Since each set f(n) is a single value, f is a function. Note that the element a  B appears as the second elements of two different ordered pairs in f. This is allowed.

Ex 2: Let A = {1, 2, 3} and B = {x, y, z}. Consider the relations R = {(1, x), (2, x), (3, x)} S = {(1, x), (1, y), (2, z), (3, y)} T = {(1, z), (2, y)}

Relation R is a function with Dom(R) = {1, 2, 3} and Ran(R) = {x}. Relation S is not a function since S(1) = {x, y}. It shows that element 1 has two images under f. Relation T is not a function since 3 has no image under f. Note that if the elements have two or more images or value, it is not a function.

Ex 3:. Let set A = B = Z, and C is a set of even integers Ex 3: Let set A = B = Z, and C is a set of even integers. Let f: A  B and g: B  C as below: f(a) = a + 1 g(b) = 2b Find the g  f We got (g  f) (a) = g(f(a)) = g(a + 1) = 2(a + 1)

This is explained with Figure 2 below: g ◦ f f g When it involves two or more functions, the product is what we called composition. b = f(a) . B . c = g(b) = g ◦ f(a) C a. A

Special Types of Functions Let f is a function from A to B. We say that f is onto if its Ran(f) = B We say that f is a one-to-one if there is no f(a1) = f(a2) for two distinguish elements a1 and a2 for A. Ex 4: Consider the Ex 1. Ran(f) = {a, c, d}  B, so f is not onto. And we can see that f(1) = f(2) = a, so f is not one-to-one.

Exercise: Let A = {a1, a2, a3, a4}; B = {b1, b2, b3}; C = {c1, c2} and D = {d1, d2, d3, d4}. Consider all function below from B to B, A to D, B to C, D to B and C to B. Identify either it is onto and/or one-to-one. f = {(b1, b2), (b2, b3), (b3, b1)} f = {(a1, d2), (a2, d1), (a3, d4), (a4, d3)} f = {(b1, c2), (b2, c2), (b3, c1)} f = {(d1, b1), (d2, b2), (d3, b1), (d4, b2)} f = {(c1, b1), (c2, b3)}

Invertible Functions A function f: A  B is said to be invertible if its reverse relation, f -1 is also a function.   Ex 5: Consider the Ex 1. So, f -1 = {(a, 1), (a, 2), (d, 3), (c, 4)} We can clearly see that f -1 is not a function because f -1 (a) = {1, 2}. So f is not an invertible function.

Theorem: Let f: A  B is a function. So, f -1 is a function from B to A if and only if f is a one-to-one function. If f is a one-to-one function, then f -1 is also a one-to-one function.

Exercise: Let A = {a, b, c, d} and B = {1, 2, 3}. Identify the relation R from A to B is a function. If it is a function, give its range. R = {(a, 1), (b, 2), (c, 1), (d, 2)} R = {(a, 1), (b, 2), (a, 2), (c, 1), (d, 2)} R = {(a, 3), (b, 2), (c, 1)} R = {(a, 1), (b, 1), (c, 1), (d, 1)}

Let A = B = C = R (real numbers) and let f: A  B, g: B  C is explained as f(a) = a + 1 and g(b) = b2 + 2. Find: (g  f)(-2) d) (f  g)(x) (f  g)(-2) e) (f  f)(y) (g  f)(x) f) (g  g)(y)

For each of below, sets A and B and its function from A to B are given For each of below, sets A and B and its function from A to B are given. Find if the function is onto and/or one-to-one. (a) A = {1, 2, 3, 4} = B; f = {(1, 1), (2, 3), (3, 4), (4, 2)} (b) A = {1, 2, 3}; B = {a, b, c, d}; f = {(1, a), (2, a), (3, c)} (c )A = {½, ¾, ¼}; B = {x, y, z, w}; f = {(½, x), (¼, y), (¾, w)} (d) A = {1.1, 7, 0.06}; B = {p, q}; f = {(1.1, p), (7, q), (0.06, p)}

Let f is a function from A = {1, 2, 3, 4} to B = {a, b, c, d} Let f is a function from A = {1, 2, 3, 4} to B = {a, b, c, d}. Find out if f -1 is a function or not. f = {(1, a), (2, a), (3, c), (4, d)} f = {(1, a), (2, c), (3, b), (4, d)}  

Permutation Function This is a part in which set A have a relation to itself. Set A is finite set. In this case, a function must be onto and one-to-one. A bijection from a set A to itself is called a permutation of A.

Ex 6: Let A = {1, 2, 3}. So, all of its permutations: 1A 1 2 3 P1 = 1 2 3 P2 = 1 2 3 1 2 3 1 3 2 2 1 3 P3 = 1 2 3 P4 = 1 2 3 P5 = 1 2 3 2 3 1 3 1 2 3 2 1

Ex 7: Using all permutation in Ex 6, find a) P4-1 b) P3  P2 a) See that P4 is a one-to-one function, we have P4 = {(1, 3), (2, 1), (3, 2)} So, P4-1 = {(3, 1), (1, 2), (2, 3)}

Put it back into P4-1 so we get That is P4-1 = 1 2 3 = P3 2 3 1

b) Function P2 relates 1 to 2 and function P3 relates 2 to 3, so, P3  P2 will relates 1 to 3. Also, P2 relates 2 to 1, and P3 relates 1 to 2, so, P3  P2 will relate 2 to 2. And P2 relates 3 to 3 and P3 relates 3 to 1, so, P3  P2 will relate 3 to 1. So, P3  P2 = 1 2 3 3 2 1

The process is like what was shown below: P3 = 1 2 3 ◦ P2 = 1 2 3 = 1 2 3 2 3 1 2 1 3 3 2 1 The composition of two permutations is another permutation, usually referred to as the product of these permutations. Theorem 1: If A = {a1, a2, …, an} is a set contained n elements, so there will be n! = n.(n – 1)… 2.1 permutation for A.

Let b1, b2, …. br are r elements of set A = {a1, a2, …. an} Let b1, b2, …. br are r elements of set A = {a1, a2, ….. an}. Permutation for P: A  A is given by: P(b1) = b2 P(b2) = b3 . P(br) = b1 P(x) = x if x  A, x  {b1, b2, … br}

This is what we called as cyclic permutation length r or cycle length r. This concept is difference from cycle concept in graph. Ex 8: Let A = {1, 2, 3, 4, 5}. Cycle (1, 3, 5) is shown by a permutation 1 2 3 4 5 3 2 5 4 1 Note that because of cyclic concept, a permutation can be written in many ways like (3, 5, 8, 2) = (5, 8, 2, 3) = (8, 2, 3, 5) = (2, 3, 5, 8)

Ex 9: Let A = {1, 2, 3, 4, 5, 6}. Find: a) (4, 1, 3, 5)  (5, 6, 3) b) (5, 6, 3)  (4, 1, 3, 5) a) (4, 1, 3, 5) = 1 2 3 4 5 6 3 2 5 1 4 6 and = 1 2 3 4 5 6 (5, 6, 3) = 1 2 3 4 5 6 3 2 4 1 6 5 1 2 5 4 6 3

Ex 9: Let A = {1, 2, 3, 4, 5, 6}. Find: a) (4, 1, 3, 5)  (5, 6, 3) b) (5, 6, 3)  (4, 1, 3, 5) b) (5, 6, 3) = 1 2 3 4 5 6 1 2 5 4 6 3 and = 1 2 3 4 5 6 (4, 1, 3, 5) = 1 2 3 4 5 6 5 2 6 1 4 3 3 2 5 1 4 6 We can see that (4, 1, 3, 5)  (5, 6, 3)  (5, 6, 3)  (4, 1, 3, 5)

Two cycles of set A is said to be disjoint if no elements of A appears in both cycles. Ex 10: Let A = {1, 2, 3, 4, 5, 6}. So, cycles (1, 2, 5) and (3, 4, 6) are disjoint cycles, while cycles (1, 2, 5) and (2, 4, 6) are not. Theorem 2: A permutation for finite set that is not an identity, can be written as a product of disjoint cycles with length  2.

Ex 11:Write a permutation on set A = {1, 2, 3, 4, 5, 6, 7, 8) as a product of disjoint cycles: 1 2 3 4 5 6 7 8 3 4 6 5 2 1 8 7 Find all the cycles: Choose P(1) = 3, P(3) = 6, and P(6) = 1, so we have a cycle (1, 3, 6).

Next, choose elements in A by choosing the first elements not in the previous found cycle(s). Choose P(2) = 4, P(4) = 5 and P(5) = 2, so we have a cycle (2, 4, 5). Choose P(7) = 8 and P(8) = 7, so the next cycle is (7, 8). Then it can be written as a product of disjoint cycle: P = (7, 8)  (2, 4, 5)  (1, 3, 6) Note that the order is not important since all cycles are disjoint. P = (2, 4, 5)  (7, 8)  (1, 3, 6) is also acceptable

Even and Odd Permutation A cycle with length two is called transposition. That is, transposition for cycle P = (ai, aj) where P(ai) = aj and P(aj) = ai. All cycle with length more than two, can be written as product of transposition. Ex 12: A cycle given by (1, 2, 3, 4, 5), so, its product of transposition: (1, 2, 3, 4, 5) = (1, 5)  (1, 4)  (1, 3)  (1, 2)

Ex 13: Write permutation P in Ex 11 as its product of transposition. We have P = (7, 8)  (2, 4, 5)  (1, 3, 6) We can write (1, 3, 6) = (1, 6)  (1, 3) (2, 4, 5) = (2, 5)  (2, 4) So we can get: P = (7, 8)  (2, 5)  (2, 4)  (1, 6)  (1, 3).

Theorem 3: If a permutation for a finite set can be written in a product of an even number of transposition, it cannot be written in odd number and so on. A permutation for finite set is called even if it can be written as a product of an even number of transpositions. It is called odd if it can be written as a product of an odd number of transpositions.

Ex 14: Is permutation below is odd or even? 2 4 5 7 6 3 1 Write P as a product of disjoint cycles: P = (1, 2, 4, 7)  (3, 5, 6) Then, wrote all cycles as a product of transposition: (1, 2, 4, 7) = (1, 7)  (1, 4)  (1, 2) (3, 5, 6) = (3, 6)  (3, 5)

So, P = (1, 7)  (1, 4)  (1, 2)  (3, 6)  (3, 5) We find out that P is a product of an odd number of permutations, and it is called odd permutation.