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.

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.
Jessie Zhao Course page: 1.
(CSC 102) Lecture 21 Discrete Structures. Previous Lecture Summery  Sum/Difference of Two Functions  Equality of Two Functions  One-to-One Function.
Functions Section 2.3 of Rosen Fall 2008
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.
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,
CS 2210 (22C:019) Discrete Structures Sets and Functions Spring 2015 Sukumar Ghosh.
Functions.
1 CMSC 250 Chapter 7, Functions. 2 CMSC 250 Function terminology l A relationship between elements of two sets such that no element of the first set is.
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.
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 and Functions Another Foundational Concept Copyright © 2014 – Curt Hill.
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.
Mathematics for Computing Lecture 8: Functions Dr Andrew Purkiss-Trew Cancer Research UK
FUNCTIONS.
Discrete Mathematics CS 2610 September 12, Agenda Last class Functions  Vertical line rule  Ordered pairs  Graphical representation  Predicates.
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.
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 
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.
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)
Functions Definition: A relation ‘ f ’ from set X to set Y is a function if each element in set X is mapped to exactly one element in set Y
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.
Agenda Week 10 Lecture coverage: –Functions –Types of Function –Composite function –Inverse of a function.
Functions. L62 Agenda Section 1.8: Functions Domain, co-domain, range Image, pre-image One-to-one, onto, bijective, inverse Functional composition and.
11 DISCRETE STRUCTURES DISCRETE STRUCTURES UNIT 5 SSK3003 DR. ALI MAMAT 1.
11 DISCRETE STRUCTURES DISCRETE STRUCTURES UNIT 5 SSK3003 DR. ALI MAMAT 1.
MAT 2720 Discrete Mathematics Section 3.1 Functions
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
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.
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.
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.
OBJECTIVES:  Find inverse functions and verify that two functions are inverse functions of each other.  Use graphs of functions to determine whether.
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 Goals Introduce the concept of function
Functions Section 2.3.
Chapter 6 – Functions 06 Learning Outcomes
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.
… and the following mathematical appetizer is about…
Functions Section 2.3.
Discrete Math (2) Haiming Chen Associate Professor, PhD
… and the following mathematical appetizer is about…
Ch 5 Functions Chapter 5: Functions
… and the following mathematical appetizer is about…
Functions Rosen 2.3, 2.5 f( ) = A B Lecture 5: Oct 1, 2.
Functions Section 2.3.
Presentation transcript:

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 c  C, denoted f( d ) = c.  d  D  c  C ( f( d ) = c   c’  D ( f( d ) = c’  c = c’ ) )  d  D  !c  C f( d ) = c. If f is a function from D to C, we write f : D  C. Functions are also known as: Mappings Transformations. Functions pass the vertical line test.

Copyright © Peter Cappello3 Definition A function is a subset of a Cartesian product: If f : D  C then f  D x C. If f : D  C then: D is f’s domain C is f’s codomain. If f( d ) = c then: c is the image of d d is a pre-image of c. f’s range is { c |  d f( d ) = c }.

Copyright © Peter Cappello4 Example Let f : Z  N be f( x ) = x 2. What is f’s domain? What is f’s codomain? What is the image of 4? What is the pre-image of 4? What is f’s range?

Copyright © Peter Cappello5 When are functions equal? Let f 1 : D  C and f 2 : D  C. Since –A function is a subset of a Cartesian product. –A Cartesian product is a set. when does f 1 = f 2 ?

Copyright © Peter Cappello6 Declaring a function’s domain & codomain The Java statement long square( int x ) { … } The domain of square is? Its codomain is?

Copyright © Peter Cappello7 Let f : D  C and S  D. The image of S under f, denoted f( S ) is { c |  s  S, f( s ) = c }. If S is finite, is | S | | f( S ) | ? Let f : N  N, f( n ) = n mod 5. –What is f’s range? –Let O = { n  N | n is odd }. –What is f( O ) ?

Copyright © Peter Cappello8 One-to-One (Injective) Functions Let f : D  C. f is one-to-one (injective) when different domain elements have different images:  a  D  b  D ( a  b  f (a )  f( b ) ). Example –Let n: { T, F }  { T, F }, such that n( p ) =  p. –Is n injective? Is f : Z  Z, f( z ) = z 2 injective? Injective functions pass the horizontal line test.

Copyright © Peter Cappello9 Onto (Surjective) Functions Let f : D  C. f is onto (surjective) when f’s range equals its codomain:  c  C  d  D ( f( d ) = c ). Example –Let or : { T, F }  { T, F }  { T, F }, such that or( p, q ) = p  q. –Is or surjective? Is f : Z  Z, f( z ) = z 2 surjective? Is f : Z  Z, f( z ) = z mod 5 surjective?

Copyright © Peter Cappello10 One-to-One Correspondence (Bijection) Function f is a one-to-one correspondence (bijection) when it is both: –one-to-one (injective) –onto (surjective). Let f : R  R, f( x ) = 2x – 7. Is f a bijection? Let f : D  C be a bijection, where D, C are finite. –Can |D| > |C|? –Can |D| < |C|?

Copyright © Peter Cappello11 Inverse Functions Let g : D  C be a bijection. The inverse function of g, denoted g -1, is the function : C  D such that if g( d ) = c, then g -1 ( c ) = d. If g is bijective, g -1 is a function because g is: – onto:  c  C ( c is the image of some element in D ) –1-to-1:  c  C (c is the image of at most 1 element in D ) –Diagram this. If g : D  C is not a bijection, does g -1 exist? Always? Sometimes? Never?

Copyright © Peter Cappello12 Composition of Functions Let functions g : B  C and f : A  B. The composition of g and f, denoted g  f, is defined by g  f( a ) = g( f( a ) ). a g(f ( a )) f( a ) AB C

Copyright © Peter Cappello13 Example Let f : Q  Q, f( x ) = 2x + 1. Let g : Q  Q, g( x ) = (x – 1)/2. What is (g  f )( 17 )? In general, what is g -1  g ( x ) ?

Copyright © Peter Cappello14 Exercise Let S  U. The characteristic function f S : U  { 0, 1 } is such that x  S  f S ( x ) = 1 x  S  f S ( x ) = 0. Show that: f A  B (x) = f A ( x )f B ( x ) f A  B (x) = f A ( x ) + f B ( x ) - f A  B ( x ) AB

Copyright © Peter Cappello End of Lecture

Copyright © Peter Cappello The Java statement long square( int x ) { … } square’s domain is int; its codomain is long. Let f & g be functions from A to R. (f + g)( x ) = f( x ) + g( x ), ( fg )( x ) = f( x )g( x ). Let f( x ) = x 2 and g( x ) = x – x 2. What is f + g? gf?

Copyright © Peter Cappello Graphs of Functions Let f : A  B. The graph of f = { (a, b) | a  A and f( a ) = b }. Example: Let the domain of f be N. Draw: f( x ) = x 2 f( x ) = x mod 2.