Fall 2015 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 7.1 Functions Defined on General Sets
Fall 2015 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University Relation (from Chap 1.3) Let A and B be sets. A relation R from A to B is a subset. Given an ordered pair, x is related to y by R, written if and only if. The set A is called the domain of R and the set B is called its co- domain. Ex. 2
Fall 2015 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University Function A function f from a set X to a set Y, denoted is a relation from X, the domain, to Y, the co-domain, that satisfies following two properties: 1) every element in X is related to some element in Y 2) no element in X is related to more than one element in Y. 3 (Arrow Diagram)
Fall 2015 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University Terminologies 4 Followings are same “ f sends x to y ” “ f maps x to y ” The unique element to which f sends x is denoted f ( x ) and called f of x the output of f for the input x the value of f at x The image of x under f.
Fall 2015 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University Terminologies 5 The set of values of f taken together is called the range of f or the image of x under f. Followings are same range of f Image of x under f Range: { a,c }
Fall 2015 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University Example 6 What is the domain and co-domain of f. Find f ( a ), f ( b ), and f ( c ). What is the range of f ? Is c an inverse image of 2? Is b an inverse image of 3? Find the inverse images of 2, 4, and 1. Represent f as a set of ordered pairs. X and Y 2, 4, 2 {2,4} Yes No { a, c }, { b }, none {( a,2),(b,4),(c,2)}
Fall 2015 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University A Test for Function Equality 7 If and are functions, then if and only if for all. Examples Let and define functions f and g from to as follows: For all x in Does f=g ? Let and be functions. Define new functions and as follows: For all Does ?
Fall 2015 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University Examples of Functions 8 The Identity Function on a Set Given a set X, define a function from X to X by Sequence A sequence can be defined as follows:
Fall 2015 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University Examples of Functions 9 Encoding and Decoding Functions Each bit in the message is replaced by three same bits The Hamming Distance Function H ( s, t ) is the number of positions in which s and t have different bits.
Fall 2015 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University Examples of Functions 10 ( n -place) Boolean Function InputOutput
Fall 2015 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University Checking Whether a Function Is Well Defined 11 Define a function by specifying that for all real number x, Why this is not a function: For almost all values of x, there is no y that satisfies the given equation, or there are two different values satisfying the equation. In general, we say a “function” is not well defined if it fails to satisfy at least one of the requirements for being a function.
Fall 2015 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University Example 12 Let Q is the set of all rational numbers. Suppose a function is to be defined by the formula Is f well defined? Why?
Fall 2015 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University Functions Acting on Sets 13 The domain and co-domain for a function can be a set (or two different sets). If is a function and and, then and f ( A ) is called the image of A, and is called the inverse image of C.