Functions Rosen 1.8.

Slides:



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

MA10209 – Week 2 Tutorial B3/B4, Andrew Kennedy. Top Tips (response to sheet 1) Make sure you answer the question - requires a yes/no as well as an explanation.
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.
Lecture 15 Functions CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
More Functions and Sets
Binary Operations.
Functions Section 2.3 of Rosen Fall 2008
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,
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 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 =
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.
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.
Week 7 - Friday.  What did we talk about last time?  Set disproofs  Russell’s paradox  Function basics.
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesFunctions.
10/26/20151 … and the following mathematical appetizer is about… Functions.
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.
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.
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
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.
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.
11 DISCRETE STRUCTURES DISCRETE STRUCTURES UNIT 5 SSK3003 DR. ALI MAMAT 1.
Math 344 Winter 07 Group Theory Part 2: Subgroups and Isomorphism
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.
Review 2 Basic Definitions Set - Collection of objects, usually denoted by capital letter Member, element - Object in a set, usually denoted by lower.
CSC102 - Discrete Structures Functions
Functions.
Functions (Mappings). Definitions A function (or mapping)  from a set A to a set B is a rule that assigns to each element a of A exactly one element.
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.
A function is a rule f that associates with each element in a set A one and only one element in a set B. If f associates the element b with the element.
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 Goals Introduce the concept of function
Function Hubert Chan (Chapter 2.1, 2.2) [O1 Abstract Concepts]
Functions Section 2.3.
Properties of Functions
Functions.
Chapter 2 Sets and Functions.
Relation and function.
Function Hubert Chan (Chapter 2.1, 2.2) [O1 Abstract Concepts]
Functions Section 2.3.
Functions CS 202 Epp section 7.1.
Functions.
Composition of Functions
Functions Rosen 6th ed., §2.3.
MAT 2720 Discrete Mathematics
Lecture # 18 Types of Functions
Functions Section 2.3.
Presentation transcript:

Functions Rosen 1.8

Definition of Function Let A and B be sets. A function f from A to B is an assignment of exactly one element of B to each element of A. We write f(a) = b if b is the only element of B assigned by the function, f, to the element of A. If f is a function from A to B, we write f:A  B. f a1 f a3 a2 A f b1 b2 b3 B

Terminology If f is a function from A to B, We say that A is the domain of f and B is the codomain of f. If f(a) = b, we say that b is the image of a and a is a pre-image of b. The range of f is the set of all images of elements of A. Also, if f is a function from A to B, we say that f maps A to B. f a1 f a3 a2 A f b1 b2 b3 B

Addition and Multiplication Let f1 and f2 be functions from A to R (real numbers).Then f1+f2 is defined as (f1+f2) (x) = f1(x) + f2(x). f1f2 is defined as (f1f2)(x) = f1(x)f2(x). And both of these are also from A to R. (Two real valued functions with the same domain can be added and multiplied.) Example: f1(x) = x2 ; f2 = x+x2 (f1+f2)(a) = a2 + a + a2 = 2a2 + a f1f2(a) = (a2)(a+a2) = a3+a4

Are f1+f2 and f1f2 Commutative? Prove: (f1+f2)(x) = (f2+f1)(x) where xR Proof: Let xR be an arbitrary element in the domain of f1 and f2. Then (f1+f2)(x) = f1(x) + f2(x) = f2(x) + f1(x) = (f2+f1)(x). Prove: (f1f2)(x) = (f2f1)(x) where xR Proof: Let xR be an arbitrary element in the domain of f1 and f2. Then (f1f2)(x) = f1(x)f2(x) = f2(x)f1(x) = (f2f1)(x).

Image Let f be a function from the set A to the set B and let S be a subset of A. The image of S is the subset of B that consists of the images of the elements of S. f(S) = {f(s) | sS}. Example: S = {a1,a2} Image of S = {b1,b2} f a1 f a3 a2 A f b1 b2 b3 B

One-to-one function A function f is said to be one-to-one, or injective, if and only if f(x) = f(y) implies that x=y for all x and y in the domain of f. a1 a2 A b2 b1 B b3 a3 f One-to-one? a1 a2 A b2 b1 B b3 a3 f b4 One-to-one? a0,a1  A [f(a0) = f(a1)]  [a0 = a1] OR [a0  a1]  [f(a0)  f(a1)]

Let f:ZZ, where f(x) = 2x Prove that f is one-to-one Proof: We must show that  x0, x1 Z [f(x0) = f(x1)  x0 = x1]. Consider arbitrary x0 and x1 that satisfy f(x0) = f(x1). By the function’s definition we know that 2x0 = 2x1. Dividing both sides by 2, we get x0 = x1. Therefore f is one-to-one.

Let g:ZZ, where g(x) = x2-x-2 Is g one-to-one? No! To prove a function is not one-to-one it is enough to give a counter example such that f(x1) = f(x2) and x1x2. Counter Example: Consider x1 = 2 and x2 = -1. Then g(2) = 22-2-2 = 0 = g(-1) = (-1)2 + 1 -2. Since g(2) = g(-1) and 2  -1, g is not one-to-one.

Define g(a,b) = (a-b, a+b) Prove that g is one-to-one. Proof: We must show that g(a,b) = g(c,d) implies that a=c and b=d for all (a,b) and (c,d) in the domain of g. Assume that g(a,b) = g(c,d), then (a-b,a+b) = (c-d,c+d) or a-b=c-d (eq 1) and a+b = c+d (eq 2) a = c-d+b from the first equation and a+b = (c-d+b) + b = c+d using the second equation 2b = 2d b=d Then substituting b for d in the second equation results in a+b = c+b a=c

Onto Function A function f from A to B is called onto, or surjective, if and only if for every element bB there is an element aA with f(a) = b. a1 a2 A b2 b1 B a3 f a1 a2 A b2 b1 B b3 a3 f bB  aA such that f(a) = b

Let f:RR, where f(x) = x2+1 Prove or disprove: f is onto Counter Example: Let f = 0, then there does not exist an x such that f(x) = x2 + 1 since x2 is always positive.

Let g:RR, where g(x) = 3x-5 Prove: g(x) is onto. Proof: Let y be an arbitrary real number (in g). For g to be onto, there must be an xR such that y = 3x-5. Solving for x, x = (y+5)/3 which is a real number. Since x exists, then g is onto.

Define g(a,b) = (a-b, a+b) for g:RR Prove that g is onto. Proof: We must show that (c,d)  (a,b) such that g(a,b) = (c,d). By definition c = a-b and d = a+b, then c + d = 2a - b + b, a = (c + d)/2; Likewise, b = (d - c)/2. Since a and b are in R, g is onto. Suppose g:ZZ. Is g onto? Why?

One-to-one Correspondence The function f is a one-to-one correspondence or a bijection, if it is both one-to-one and onto. a1 a2 A b2 b1 B a3 f Bijection? a1 a2 A b2 b1 B b3 a3 f Bijection?

Correspondence Diagrams: One-to-One or Onto? b c d a b c d 1 2 3 4 1 2 3 4 a b c 1 2 3 One-to-one, not onto Onto, not one-to-one One-to-one, and onto a b c d 1 2 3 4 a b c 1 2 3 4 a b c d 1 2 3 4 Not a function! Not a function! Neither one-to-one nor onto

Inverse Function, f-1 Let f be a one-to-one correspondence from the set A to the set B. The inverse function of f is the function that assigns to an element b belonging to B the unique element a in A such that if f(a) = b, then f-1(b) = a. a b f f-1 Example: f(a) = 3(a-1) f-1(b) = (b/3)+1

Define g(a,b) = (a-b, a+b) Find the inverse function g-1 c = a-b, d = a + b. Then since g-1(c,d) = (a,b), g-1(c,d) = ( (c+d)/2, (d-c)/2 ) = (a,b). Further, g(g-1(c,d)) = g((c+d)/2, (d-c)/2 ) = ((c+d)/2 -(d-c)/2, (c+d)/2 + (d-c)/2 ) = (2c/2, 2d/2) = (c,d).

Examples Is each of the following (on the real numbers): a function? one-to-one? Onto? Invertible? f(x) = 1/x not a function f(0) undefined f(x) = x not a function since not defined for x<0 f(x) = x2 is a function, not 1-to-1 (-2,2 both go to 4), not onto since no way to get to the negative numbers, not invertible

Composition of Functions Let g be a function from the set A to the set B and let f be a function from the set B to the set C. The composition of the functions f and g, denoted by fg, is defined by (fg)(a) = f(g(a)). a g(a) f(g(a)) g f A B C Example: Let f and g be functions from Z to Z such that f(x) = 2x+3 and g(x) = 3x+2 fg(4) = f(g(4)) = f(3(4)+2) = f(14) = 2(14)+3 = 31

Suppose that g:AB and f:BC are both onto. Is (fg) onto? Proof: We must show that yC, xA such that y = (fg)(x) = f(g(x)). Let y be an arbitrary element of C. Since f is onto, then bB such that y = f(b). Now, since g is onto, then b = g(x) for some xA. Hence y = f(b) = f(g(x)) = (fg)(x) for some xA. Hence, (fg) is onto.

Suppose that g:AB and f:BC and f and (fg) are onto, is g onto? 2 4 -1 -2 1 g f B C A Counter Example: Let A be the set of natural numbers, B be the set of integers and C be the set of squares of integers where g(a) = -a and f(b) =b2 Then g:NZ and f:ZZ2. (fg)(a) = f(-a) = a2 is onto, f(b) = b2 is onto, but 1 in B is not since we can’t map from A to positive integers in B.

Other interesting questions Suppose that g:AB and f:BC are both one-to-one. Is (fg) one-to-one? Does (fg) = (gf)?

Show that (fg) is one-to-one if g:AB and f:BC are both one-to-one. Proof: We must show that,  x,yA, xy  (fg)(x)  (fg)(y). Let x,y be distinct elements of A. Then, since g is one-to-one, g(x)  g(y). Now, since g(x)  g(y) and f is one-to-one, then f(g(x)) = (fg)(x)  f(g(y)) = (fg)(y). Therefore xy  (fg)(x)  (fg)(y), so the composite function is one-to-one.

Does (fg) = (gf)? A C B f g f(g(a)) a g(a) c g(f(c )) f(c) f g No. A counter example is let f:ZZ and g:ZZ and g(a) = a2 and f(a) = 2a. Then (fg)(3) = f(g(3)) = f(9) = 18 (gf)(3) = g(f(3)) = g(6) = 36