Section 4.4 Functions. CS 130 Discrete Structures

Similar documents
9/21/2018. Properties of Functions. Properties of Functions. Properties of Functions. Properties of Functions. Properties of Functions

2.1 Sets. Definition 1 A set is an unordered collection of objects. Important sets: N, Z, Z +, Q, R.

Functions. Given a function f: A B:

Functions as Relations

3 FUNCTIONS. 3.1 Definition and Basic Properties. c Dr Oksana Shatalov, Spring

3 FUNCTIONS. 3.1 Definition and Basic Properties. c Dr Oksana Shatalov, Fall

3 FUNCTIONS. 3.1 Definition and Basic Properties. c Dr Oksana Shatalov, Fall

Section Summary. Definition of a Function.

0 Sets and Induction. Sets

Today s Topics. Methods of proof Relationships to logical equivalences. Important definitions Relationships to sets, relations Special functions

Discussion Summary 10/16/2018

5 FUNCTIONS. 5.1 Definition and Basic Properties. c Dr Oksana Shatalov, Fall

9 FUNCTIONS. 9.1 The Definition of Function. c Dr Oksana Shatalov, Fall

Notes. Functions. Introduction. Notes. Notes. Definition Function. Definition. Slides by Christopher M. Bourke Instructor: Berthe Y.

CS100: DISCRETE STRUCTURES

Functions Functions and Modeling A UTeach/TNT Course

Sets. We discuss an informal (naive) set theory as needed in Computer Science. It was introduced by G. Cantor in the second half of the nineteenth

CHAPTER 7 FUNCTIONS. Alessandro Artale UniBZ - artale/

LESSON RELATIONS & FUNCTION THEORY

2 Functions. 2.1 What is a function?

Func%ons. function f to the element a of A. Functions are sometimes called mappings or transformations.

Solutions for Chapter Solutions for Chapter 17. Section 17.1 Exercises

Sets and Functions. (As we will see, in describing a set the order in which elements are listed is irrelevant).

CS 220: Discrete Structures and their Applications. Functions Chapter 5 in zybooks

9/21/17. Functions. CS 220: Discrete Structures and their Applications. Functions. Chapter 5 in zybooks. definition. definition

Sec$on Summary. Definition of a Function.

MATH 220 (all sections) Homework #12 not to be turned in posted Friday, November 24, 2017

MATH 215 Sets (S) Definition 1 A set is a collection of objects. The objects in a set X are called elements of X.

Functions. Definition 1 Let A and B be sets. A relation between A and B is any subset of A B.

Chapter 1 : The language of mathematics.

Sets and Functions. MATH 464/506, Real Analysis. J. Robert Buchanan. Summer Department of Mathematics. J. Robert Buchanan Sets and Functions

4.1 Real-valued functions of a real variable

Propositional Logic, Predicates, and Equivalence

Solutions to Homework Problems

Chapter Summary. Sets (2.1) Set Operations (2.2) Functions (2.3) Sequences and Summations (2.4) Cardinality of Sets (2.5) Matrices (2.

447 HOMEWORK SET 1 IAN FRANCIS

Sets, Functions and Relations

1. Decide for each of the following expressions: Is it a function? If so, f is a function. (i) Domain: R. Codomain: R. Range: R. (iii) Yes surjective.

Functions and Their Graphs

Section 7.1: Functions Defined on General Sets

MATH 22 FUNCTIONS: COMPOSITION & INVERSES. Lecture N: 10/16/2003. Mad world! mad kings! mad composition! Shakespeare, King John, II:1

Section 0. Sets and Relations

MATH 433 Applied Algebra Lecture 14: Functions. Relations.

Chapter Summary. Sets The Language of Sets Set Operations Set Identities Functions Types of Functions Operations on Functions Computability

Section 7.2: One-to-One, Onto and Inverse Functions

Real Analysis. Joe Patten August 12, 2018

Cartesian Products and Relations

MATH 3330 ABSTRACT ALGEBRA SPRING Definition. A statement is a declarative sentence that is either true or false.

Mathematics Review for Business PhD Students Lecture Notes

Introduction to Decision Sciences Lecture 6

MATH FINAL EXAM REVIEW HINTS

(So SamID 1 ( ) = Ken W. Smith.)

1. Continuous Functions between Euclidean spaces

Section Summary. Definition of a Function.

Week Some Warm-up Questions

Review Problems for Midterm Exam II MTH 299 Spring n(n + 1) 2. = 1. So assume there is some k 1 for which

MATH 102 INTRODUCTION TO MATHEMATICAL ANALYSIS. 1. Some Fundamentals

Mathematics Review for Business PhD Students

Topics in Logic, Set Theory and Computability

RED. Fall 2016 Student Submitted Sample Questions

LECTURE NOTES DISCRETE MATHEMATICS. Eusebius Doedel

Cardinality and ordinal numbers

COM S 330 Homework 05 Solutions. Type your answers to the following questions and submit a PDF file to Blackboard. One page per problem.

Lecture Notes on DISCRETE MATHEMATICS. Eusebius Doedel

Groups. Contents of the lecture. Sergei Silvestrov. Spring term 2011, Lecture 8

Solved Examples. Given are two sets A {1, 2, -2, 3} and B = {1, 2, 3, 5}. Is the function f(x) = 2x - 1 defined from A to B?

COMPOSITION OF FUNCTIONS

Chapter 0. Introduction: Prerequisites and Preliminaries

(a) We need to prove that is reflexive, symmetric and transitive. 2b + a = 3a + 3b (2a + b) = 3a + 3b 3k = 3(a + b k)

MATH 13 FINAL EXAM SOLUTIONS

Chapter 2 Invertible Mappings

Functions and cardinality (solutions) sections A and F TA: Clive Newstead 6 th May 2014

Chapter 1. Sets and Mappings

RELATIONS AND FUNCTIONS

SETS AND FUNCTIONS JOSHUA BALLEW

Review of Functions. Functions. Philippe B. Laval. Current Semester KSU. Philippe B. Laval (KSU) Functions Current Semester 1 / 12

Selected problems from past exams

Modern Computer Algebra

MTH4100 Calculus I. Lecture notes for Week 2. Thomas Calculus, Sections 1.3 to 1.5. Rainer Klages

CIS 375 Intro to Discrete Mathematics Exam 3 (Section M001: Green) 6 December Points Possible

Abstract Algebra I. Randall R. Holmes Auburn University. Copyright c 2012 by Randall R. Holmes Last revision: November 11, 2016

QUESTION BANK II PUC SCIENCE

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

MATH 363: Discrete Mathematics

Introduction to Functions

RINGS: SUMMARY OF MATERIAL

RED. Name: Math 290 Fall 2016 Sample Exam 3

UWO CS2214 Feb. 4, Assignment #1 Due: Feb. 12, 2017, by 23:55 Submission: on the OWL web site of the course

Functions. Chapter Introduction to Functions

Math 320: Real Analysis MWF 1pm, Campion Hall 302 Homework 2 Solutions Please write neatly, and in complete sentences when possible.

REVIEW FOR THIRD 3200 MIDTERM

SCHOOL OF BUSINESS, ECONOMICS AND MANAGEMENT BUSINESS MATHEMATICS / MATHEMATICAL ANALYSIS

1 Take-home exam and final exam study guide

ICS141: Discrete Mathematics for Computer Science I

FREE Download Study Package from website: &

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes

QF101: Quantitative Finance August 22, Week 1: Functions. Facilitator: Christopher Ting AY 2017/2018

Test 2 Review Math 1111 College Algebra

Notes for Math 290 using Introduction to Mathematical Proofs by Charles E. Roberts, Jr.

MAT115A-21 COMPLETE LECTURE NOTES

Transcription:

Section 4.4 Functions CS 130 Discrete Structures

Function Definitions Let S and T be sets. A function f from S to T, f: S T, is a subset of S x T where each member of S appears exactly once as the first component of an ordered pair. S is the domain of the function. T is the codomain of the function. If (s, t) belongs to the function, then t is denoted by f(s) t is the image of s under f s is a preimage of t under f f is said to map s to t CS 130 Discrete Structures 39

Diagrams Representation If A and B are finite sets, an arrow diagram shows a function f from A to B by drawing an arrow from each element in A to the corresponding element of B Two properties must be held in the arrow diagram according to the definition of function: Every element of A has an arrow coming out of it No one element of A has two arrows coming out of it that point to two different elements of B Example CS 130 Discrete Structures 40

Examples Which of the following are functions? f: S T where S = T = {1, 2, 3}, f = {(1,1),(2,3),(2,1)} g: Z N where g(x) = x (absolute value of x) h: N N where h(x) = x 4 f: R R where f(x) = 4x 1 more examples from the book For f: Z Z where f(x) = x 2 what is the image of 4 what are the preimages of 9 CS 130 Discrete Structures 41

Several Common Math Functions Floor function associates with each real number x the greatest integer less than or equal to x E.g., 2.8 =?, - 2.8 =? Ceiling function associates with each real number x the smallest integer greater than or equal to x E.g, 2.8 =?, -2.8 =? Modulo function f(x) = x mod n associates with x the remainder when x is divided by n we can write x = qn+ r, r is between [0, n-1] 10 mod 3 = 1 CS 130 Discrete Structures 42

Functions With Multiple Variables A function can include more than one variable. A function can be defined as f: S 1 S 2 S n T that associates with each ordered n-tuple of elements (s 1, s 2,, s n ) Example: f: Z Z Z is given by f(x,y) = x+y CS 130 Discrete Structures 43

Properties of Functions: Surjective Three properties: surjective (onto), injective, bijective Let f: S T be an arbitrary function every member of S has an image under f and all the images are members of T the set R of all such images is called the range of the function f A function f: S T is an onto, or surjective, function if the range of f equals the codomain of f CS 130 Discrete Structures 44

Example of Surjective Functions To prove a function to be surjective: need to show that an arbitrary member of the codomain T is a member of the range R, thus it is the image of some member of the domain, we have T R To disprove it: if we can find one member of the codomain that is not the image of any member of the domain Let f: Q Q where f(x) = 3x + 2 Let g: Z N where g(x) = x Let f: R R where f(x) = 4x 1 CS 130 Discrete Structures 45

Properties of Functions: Injective, Bijective A function f: S T is an one-to-one or injective, if no member of T is the image under f of two distinct elements of S To prove a function is injective: we assume that there are elements s 1 and s 2 of S with f(s 1 ) = f(s 2 ) and then show that s 1 = s 2 To disprove it: counterexample, where an element in the range has two preimages in the domain A function f: S T is bijective, if it is both surjective and injective CS 130 Discrete Structures 46

Examples The function g: R R where g(x) = x 3 surjective, injective, bijective The function f: N N where f(x) = x 2 not surjective, injective, not bijective CS 130 Discrete Structures 47

In General CS 130 Discrete Structures 48

Composition of Functions Let f : S T and g : T U. Then the composition function, g f, is a function from S to U defined by ( g f )( s) g( f ( s)). Function f is applied first, and then function g It is not always possible to take any two arbitrary functions and compose them since the domain and the ranges have to be compatible. Note that composition preserves the properties of being onto and being one-to-one Composition on two bijections is a bijection CS 130 Discrete Structures 49

Examples Let f: R R be defined by f(x) = x 2 and g: R R be defined by g(x) = x What is the value of (g f) (2.3)? g(f(2.3)) = g(5.39) = 5 What is the value of (f g) (2.3)? f(g(2.3)) = f(2) = 4 Order is important in function composition The following functions map R to R. Give an equation describing the composition functions f g and g f in each case: f(x) = 3x 2, g(x) = 5x CS 130 Discrete Structures 50

More Examples Given the following function, decide whether it is 1-to-1 or onto: f: N N, f(x) = x + 1 but 1-to-1 Proof that f is one-to-one. Let f(s 1 ) = f(s 2 ) for s 1, s 2. Then s 1 + 1 = s 2 + 1 definition of f s 1 = s 2 algebra f is one-to-one CS 130 Discrete Structures 51

Proofs Let f: S T and g: T U, and assume that both f and g are one-to-one (injective) functions. Prove that g f is a one-to-one function. Let f: S T and g: T U be functions Prove that if g f is 1-to-1, so is f. Prove that if g f is onto, so is g. Find an example where g f is 1-to-1, but g is not 1- to-1. Find an example where g f is onto but f is not onto. CS 130 Discrete Structures 52

Inverse Functions Bijective functions have another property: Every element s in S has an image in T and every element of T has a unique inverse image in S since the f is onto and one-to-one If there is a function f which has a one-to-one correspondence from a set S to a set T, then there is a function g from T to S that "undoes" the action of f. This function g is called the inverse function for f. Then g f (s) = s maps each element to itself. Such a function which leave an element unchanged is called the identity function on S and is denoted by i s Show that f g = i T CS 130 Discrete Structures 53

Inverse Functions Definition: Let f: S T. If there exists a function g: T S, such that g f = i S and f g = i T Then g is called the inverse function of f and is denoted by f 1 Example: f: R R given by f(x) = 3x + 4 is a bijection. Describe f 1 Theorem on Bijections and Inverse Functions: Let f: S T. Then f is a bijection if and only if f 1 exists CS 130 Discrete Structures 54

More Proofs Let f and g be bijections, f: S T and g: T U. Then f -1 and g -1 exist. Also g f is a bijection from S to U. CS 130 Discrete Structures 55

Summary of Function Terminologies Term function domain codomain image preimage range onto (surjective) one-to-one (injective) bijection identity function inverse function Meaning A function f from set S to set T is a relationship between elements of S and elements of T where each element of S is related to a unique element of T. It is denoted by f: S T. Starting set for a function Ending set for a function Point that results from a mapping Starting point for a mapping Collection of all images of a domain Range is the whole codomain; every codomain element has a preimage No two elements in a domain map to the same place One-to-one and onto Maps each element of set to itself For a bijection, a new function that maps each codomain element back where it came from CS 130 Discrete Structures 56

Exercises Let S = {0, 2, 4, 6} and T = {1, 3, 5, 7}. Determine whether each of the following sets of ordered pairs is a function with domain S and codomain T. If so, it is 1-to-1? Is it onto? a. {(0, 2), (2, 4), (4, 6), (6, 0)} b. {(6, 3), (2, 1), (0, 3), (4, 5)} c. {(2, 3), (4, 7), (0, 1), (6, 5)} d. {(2, 1), (4, 5), (6, 3)} e. {(6, 1), (0, 3), (4, 1), (0, 7), (2, 5)} CS 130 Discrete Structures 57

Exercises Which of the following are functions from the domain to the codomain given? Which functions are 1-to-1 or onto or both? Describe the inverse function for any bijective function. a. f: Z N where f(x) = x 2 + 1 b. g: N Q where g(x) = 1/x c. h: Z x N Q where h(z, n) = z/(n+1) d. f: {1, 2, 3} {p, q, r} where f = {(1, q), (2, p), (3, r)} e. g: N N where g(x) = 2 x f. h: R 2 R 2 where h(x, y) = (y + 1, x + 1) CS 130 Discrete Structures 58

Exercises Let P be the power set of {a, b, c}. A function f: P Z follows: for A in P, f(a) = the number of elements in A. Is f 1-to-1? Is f onto? CS 130 Discrete Structures 59

Exercises Let f: N N be defined by f(x) = x + 1. Let g: N N be defined by g(x) = 3x. Calculate the following: a. (g f)(x) b. (f g)(x) c. (f f)(x) d. (g g)(x) CS 130 Discrete Structures 60

Exercises The following functions map R to R. Give an equation describing the composition functions (g f) and (f g) in each case. a. f(x) = 6x 3, g(x) = 2x b. f(x) = (x-1)/2, g(x) = 4x 3 c. f(x) = x, g(x) = x CS 130 Discrete Structures 61

Exercises For each of the following bijections f: R R, and g: R 2 R 2 find f -1 and g -1. a. f(x) = 2x b. f(x) = x 3 c. f(x) = (x+4)/3 d. g(x, y) = (2x, y+1) CS 130 Discrete Structures 62