functions cosc-1321 discrete structures 1. function. definition let x and y be sets. a function f...

28
FUNCTIONS COSC-1321 Discrete Structures 1

Upload: mabel-turner

Post on 18-Jan-2018

216 views

Category:

Documents


0 download

DESCRIPTION

Functions Functions are also called mappings or transformations. We say that f maps X to Y 3 X Y f

TRANSCRIPT

Page 1: 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

FUNCTIONSCOSC-1321 Discrete Structures

1

Page 2: 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

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 that, for each element , there is exactly one element such that x f y:

• Since any relation from X to Y is a subset of X x Y, a function is a subset S of X x Y such that for each there is a unique with

2

x X y Y ,x y S

: ; ( )f X Y y f x

x Xy Y

Page 3: 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

Functions

• Functions are also called mappings or transformations. We say that f maps X to Y

3

X Y

f

Page 4: 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

Functions

• If f is a function from X to Y

the sets X and Y are called the domain and codomain of the function, respectively.

• The unique element is called the image of and is a preimage of under f.

• The range of f is the set of all images of elements of X in Y.

4

x Xy Y

: ; ( ),f X Y y f x

x X y Y

Page 5: 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

Range

• If f is a function from X to Y

and is a subset of the codomain such that

(thus contains all the elements from Y that are paired with elements of the domain X), then is called the range of the function.

5

: ; ( ),f X Y y f x Y Y

ˆ : ( )y Y x X y f x

Y

Y

Page 6: 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

Function

• f : X →Y, X is the domain, Y is the codomain, is the range

6

X Y

f

is the range

Y

Y

Page 7: 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

Not a Function• This relation is not a function because there is an element

in X, which is not a preimage of any element in Y

7

X Y

Page 8: 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

Functions

• To define a function, it is necessary to specify its domain, its codomain and the mapping of elements of the domain to elements in the codomain

• Two functions are equal when they have the same domain, have the same codomain, and map elements of their common domain to the elements of their common codomain

• If we change either the domain or the codomain of a function, then we obtain a different function

8

Page 9: 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

Image

• Let f be a function from the set X to the set Y and . The image of S under the function f is a subset of Y that consists of the images of the elements of S

9

S X

| , ( )f S t x S t f x

Page 10: 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

Image

10

X Y

fF(S) is the image of S

S X

( )F S Y

Page 11: 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

One-to-one Function

• If f is a function from X to Y

and no two distinct elements of the domain are assigned the same element in the codomain, then the function is called one-to-one (or injective).

• To show that a function f is one-to-one, it is necessary to show that

11

1 2 1 2 1 2 : x X x X f x f x x x x

: ; ( ),f X Y y f x

Page 12: 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

One-to-one Function

12

X Y

f

Page 13: 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

Onto Function

• If the range and codomain of a function are equal, the function is called onto (or surjective)

• To show that a function f is onto, it is necessary to show that

13

: ( )y Y x X y f x

Page 14: 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

Onto Function

14

YX

f

Page 15: 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

One-to-one Correspondence

• A function, which is both one-to-one and onto is called a one-to-one correspondence (or bijection)

• To show that a function f is a one-to-one correspondence, it is necessary to show that

thus, for each there is exactly one such that means “there exists exactly one”

15

! : ( )y Y x X y f x y Y x X

( )y f x

!

Page 16: 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

One-to-one Correspondence

16

YX

f

Page 17: 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

Useful properties

• Any one-to-one correspondence is onto and one-to-one

• Onto and one-to-one are not necessary one-to-one correspondences

• If onto is a one-to-one correspondence, it is also one-to-one

• If one-to-one is a one-to-one correspondence, it is also onto

17

Page 18: 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

Identity Function

• For any set X, the function

is one-to-one correspondence. This function is called the identity function on X.

18

: ; ( )X XI X X x X I x x

Page 19: 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

Inverse Function

• Let be a one-to-one correspondence, then for each there is exactly one such that .

• Hence we may define a function with domain Y and codomain X by associating to each the unique such that . This function is denoted by and is called the inverse of function f.

19

:f X Yy Y

x X ( )y f x

y Yx X ( )y f x

1f

Page 20: 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

Inverse Function

20

YX

f

f -1

Page 21: 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

Inverse Function

• Theorem. Let is one-to-one correspondence. Then:

• is one-to-one correspondence

• The inverse function of is f.• ,

that is

21

:f X Y

1 :f Y X 1f

1 1, ( ) ; , ( )x X f f x x y Y f f y y

1 1; X Yf f I f f I

Page 22: 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

Composition of Functions

• Let g be a function from X to Y and f be a function from Y to Z. Then it is possible to combine these two functions in a function f○g from X to Z.

• The function f○g is called the composition of f and g and is defined by taking the image of x under f○g to be f(g(x)):

22

( ) ( ) f g x f g x x X

Page 23: 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

Composition of Functions

• Composition f○g cannot be defined unless the range of g is a subset of the domain of f

23

X Y Z

Page 24: 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

Exponential Function with base 2

• The equation defines a function with the set of real numbers as its domain and the set of positive real numbers as its codomain. This function is called the exponential function with base 2.

24

( ) 2 ,xf x x R

Page 25: 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

Exponential Function with base n

• In general, the equation defines a function with the set of real numbers as its domain and the set of positive real numbers as its codomain. This function is called the exponential function with base n.

25

( ) ,xf x n x R

Page 26: 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

Logarithmic Function with base n

• Evidently, the exponential function with base n is a one-to-one correspondence because each element of the codomain is associated with exactly one element of the domain.

• This means that the exponential function with base n has and inverse g called the logarithmic function with base n:

26

( ) logng x x

Page 27: 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

Logarithmic Function with base n

• Particularly, the logarithmic function with base 2 is the inverse of the exponential function with base 2.

• The definition of an inverse function implies that if and only if :

27

logny x

2( ) logg x x

yx nlog y

ny x x n

Page 28: 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

Some other useful functions

• The floor function assigns to the real number x the largest integer that is ≤ x. The floor function at x is denoted

• The ceiling function assigns to the real number x the smallest integer that is ≥x. The ceiling function at x is denoted

• Examples:

28

x

x

5.9 5; 5.9 6; 5.1 5; 5.1 6