Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!

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

Jessie Zhao Course page: 1.
Functions Section 2.3 of Rosen Fall 2008
Discrete Structures Chapter 5 Relations and Functions Nurul Amelina Nasharuddin Multimedia Department.
Lecture 3 Set Operations & Set Functions. Recap Set: unordered collection of objects Equal sets have the same elements Subset: elements in A are also.
CSE115/ENGR160 Discrete Mathematics 02/16/12 Ming-Hsuan Yang UC Merced 1.
modified from UCI ICS/Math 6D, Fall Sets+Functions-1 Sets “Set”=Unordered collection of Objects “Set Elements”
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.
Discrete Structures Functions Dr. Muhammad Humayoun Assistant Professor COMSATS Institute of Computer Science, Lahore.
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.
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.
Mathematics. Session Set, Relation & Function Session - 3.
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.
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.
Discrete Mathematics CS 2610 September 12, Agenda Last class Functions  Vertical line rule  Ordered pairs  Graphical representation  Predicates.
4.1 CompSci 102© Michael Frank Today’s topics FunctionsFunctions – –Notations and terms – –One-to-One vs. Onto – –Floor, ceiling, and identity Reading:
Functions Section 2.3 of Rosen Spring 2012 CSCE 235 Introduction to Discrete Structures Course web-page: cse.unl.edu/~cse235 Questions: Use Piazza.
MSU/CSE 260 Fall Functions Read Section 1.8.
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.
Based on Rosen, Discrete Mathematics & Its Applications, 5e Prepared by (c) Michael P. Frank Modified by (c) Haluk Bingöl Module #4.
321 Section, Week 3 Natalie Linnell. Functions A function from A to B is an assignment of exactly one element of B to each element of A. We write f(a)
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 
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 and Functions Contents  Set language  Basic knowledge on sets  Intervals  Functions (Mappings)
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.
Functions Section 2.3. Section Summary Definition of a Function. – Domain, Cdomain – Image, Preimage Injection, Surjection, Bijection Inverse Function.
Functions. L62 Agenda Section 1.8: Functions Domain, co-domain, range Image, pre-image One-to-one, onto, bijective, inverse Functional composition and.
Basic Structures: Sets, Functions, Sequences, and Sums.
CSC102 - Discrete Structures Functions
Functions.
1 Functions CS 202 Epp section ??? Aaron Bloomfield.
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.
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.
Discrete Mathematics Functions
Functions 7/7/2016COCS - Discrete Structures1. Functions A function f from a set A to a set B is an assignment of exactly one element of B to each element.
Functions Section 2.3.
Applied Discrete Mathematics Week 2: Functions and Sequences
Functions.
… and the following mathematical appetizer is about…
Functions.
Functions Section 2.3.
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…
Functions CS 202 Epp section 7.1.
CS 220: Discrete Structures and their Applications
Functions.
Ch 5 Functions Chapter 5: Functions
… and the following mathematical appetizer is about…
Functions Rosen 6th ed., §2.3.
Functions Section 2.3.
Copyright © Zeph Grunschlag,
Presentation transcript:

Functions

Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples! What’s that?

Let A be the set of women {Andrea,Mary,Betty,Susie,Bervely} Let B be the set of men {Phil, Andy, Ian, Dick, Patrick,Desmond} f: A -> B (i.e. f maps A to B) f(a) : is married to … delivers husband f = {(Andrea,Patrick),(Beverly,Phil), (Susie,Dick), (Mary,Ian),(Betty,Andy)} Example of a function

Andrea Mary Betty Susie Beverly Phil Andy Ian Dick Patrick Desmond Domain Codomain A value in the domain maps to only one value in codomain otherwise it is not a function F(Andrea) = Patrick Patrick is the image of Andrea Andrea is the preimage of Patrick

A is the domain B is codomain f(x) = y y is image of x x is preimage of y There may be more than one preimage of y marriage? Wife of? A man with many wives? Kidding? There is only one image of x otherwise not a function There may be an element in the codomain with no preimage Desmond ain’t married Range of f is the set of all images of A the set of all results f(A) = {Patrick,Ian,Phil,Andy,Dick} the image of A = {Andrea,Mary,Beverly,Betty,Susie}

The image of a set S F({Andrea,Mary,Beverly})={Ian,Patrick,Phil}

Another Function A function has a graph!

Another Function Notice that we can have an “explicit” representation of a function as a set of tuples (in this case “pairs”) … and we have already said so

We can add and multiply functions … so long as they have the same domains and codomains “domain” on the left hand side “codomain” on the right hand side (set of results)

Adding and multiplying functions

Types of functions injection strictly increasing/decreasing surjection bijection

Injection (aka one-to-one, 1-1) a b c d x y z w injection a b c d x y z not an injection If an injection then preimages are unique

Injection (aka one-to-one, 1-1) a b c d x y z w injection If f:A  B injective (1-1) then  A  B 

Strictly increasing/decreasing strictly increasing if x  y then f(x)  f(y) strictly decreasing if x > y then f(x) > f(y) Note: must therefore be 1-1 (i.e. f(x) = f(y)  x=y)

OnTo/Surjective f:A  B is onto/surjective iff for every element b  B there is an element a  A such that f(a) = b Each value in the codomain has a preimage a b c d x y z w surjection e a b c d x y z w Not a surjection e

OnTo/Surjective Is this onto/surjective? f:A  B where A = {a,b,c,d} B = {1,2,3} f = {(a,3),(b,2),(c,1),(d,3)} Each value in the codomain has a preimage a b c d x y z w surjection e a b c d x y z w Not a surjection e

Is the function marriedTo(x) surjective? injective?

Bijection (1-1 correspondence) f is a bijection iff it is both 1-1 and onto f(a) = f(b)  a = b (1-1) each element of codomain has a preimage (onto) a b c d x y z w bijection

Summary 1-1/injection/one-to-one f(a) = f(b)  a = b codomain is at least as large as domain onto/surjection every element of codomain has a preimage bijection 1-1 and onto domain and codomain same size

For the class Given the following functions state if they are injections (1-1), surjections, or bijections.

Inverse of a function

Invertable functions For inverse to exist function must be a bijection

Composition The composition of f with g

Composition If g:A  B and f:B  C then (f  g)(x) = f(g(x)) Can only compose functions f and g if the range of g is a subset of the range of f

Composition … an example Let g be the function from student number numbers to student Let f be the function from students to postal codes (f  g)(a) = f(g(a)) delivers the postal code corresponding to a student number Note: A is set of student numbers B is set of students C is set of postal codes

Composition … an other example

For the class g:A  A where A={a,b,c} and g = {(a,b),(b,c),(c,a)} f:A  B where B={1,2,3} and f = {(a,3),(b,2),(c,1)} give compositions f  g and g  f 17

Two important functions

A man can lift 10 units of weight How many men do we need to lift 81 units?

[floor(x:float) : integer -> integer!(x)] // // The largest integer that is less than or equal to x // (a) If x >= 0 this amounts to truncation beyond the decimal point // (b) If x < 0 (negative) // then if there is anything after the decimal then // truncate and then subtract 1 (i.e becomes -1) // Floor

[ceiling(x:float) : integer -> if (float!(floor(x)) < x) floor(x) + 1 else floor(x)] // // The smallest integer that is greater than x // eg. ceiling(3.1) = 4, ceiling(-3.1) = -3 // Ceiling

Get a Headache So, every element in the domain maps to one element in the codomain Every element in codomain has unique pre-image The function is bijective Therefore cardinality of N is same as cardinality of E What?

fin