14
Discrete Mathematics CS 2610 September 12, 2006

Discrete Mathematics CS 2610 September 12, 2006. 2 Agenda Last class Functions Vertical line rule Ordered pairs Graphical representation Predicates

Embed Size (px)

Citation preview

Page 1: Discrete Mathematics CS 2610 September 12, 2006. 2 Agenda Last class Functions  Vertical line rule  Ordered pairs  Graphical representation  Predicates

Discrete Mathematics CS 2610

September 12, 2006

Page 2: Discrete Mathematics CS 2610 September 12, 2006. 2 Agenda Last class Functions  Vertical line rule  Ordered pairs  Graphical representation  Predicates

2

Agenda

Last class Functions

Vertical line rule Ordered pairs Graphical representation Predicates as functions

This class More on functions!

Page 3: Discrete Mathematics CS 2610 September 12, 2006. 2 Agenda Last class Functions  Vertical line rule  Ordered pairs  Graphical representation  Predicates

3

Function TerminologyGiven a function f:AB

A is the domain of f. B is the codomain of f.

If f(a)=b, b is the image of a under f.

a is a pre-image of b under f. In general, b may have more than 1 pre-image.

The range R of f (or image of f) is :

R={b | a f(a)=b } -- the set of all images

For any set S A, the image of S, f(S) = { b B | a S, b = f(a)}

For any set T B, the inverse image of T f−1(T) = { a A | f(a) T }

Page 4: Discrete Mathematics CS 2610 September 12, 2006. 2 Agenda Last class Functions  Vertical line rule  Ordered pairs  Graphical representation  Predicates

4

Example

Mike Mario

Kim

Joe Jill

John Smith

Edward Jones

Richard Boone

f

A BDomain Codomain

The image of Mike under f is John SmithMike is a pre-image of John Smith under f

R (f) = {John Smith, Richard Boone}

f(Mike,Mario,Jill) = {John Smith, Richard Boone}

f-1(Richard Boone) = {Joe, Jill}

Page 5: Discrete Mathematics CS 2610 September 12, 2006. 2 Agenda Last class Functions  Vertical line rule  Ordered pairs  Graphical representation  Predicates

5

ExampleGiven a function f: Z Z where f(x) = x2

-- the domain of f is the set of all integers

-- the codomain of f is the set of all integers

-- the range of f is the set of all integers that are perfect squares {0, 1, 4, 9, 16, 25, …}

Page 6: Discrete Mathematics CS 2610 September 12, 2006. 2 Agenda Last class Functions  Vertical line rule  Ordered pairs  Graphical representation  Predicates

6

Function Composition

Given the functions g:AB and f:BC, the composition of f and g, f ○g: AC defined as

f ○g (a) = f ( g (a) )

h

b

d

o

2

3

5

1

7

fg

A B C

f ○g (h) ?

Page 7: Discrete Mathematics CS 2610 September 12, 2006. 2 Agenda Last class Functions  Vertical line rule  Ordered pairs  Graphical representation  Predicates

7

Function Composition

Properties

Associative: Given the functions g:AB and f:BC and h:CD then

h ○ (f ○g) (h ○ f ) ○ g

Page 8: Discrete Mathematics CS 2610 September 12, 2006. 2 Agenda Last class Functions  Vertical line rule  Ordered pairs  Graphical representation  Predicates

8

Function Self-Composition

A function f: AA (the domain and codomain are the same) can be composed with itself

f: People People

where f(x) is the father of x

f ○f (Mike) is the father of the father of Mike

f ○f ○ f (Mike) ?

f ○f ○ f ○ f(Mike) ?

Page 9: Discrete Mathematics CS 2610 September 12, 2006. 2 Agenda Last class Functions  Vertical line rule  Ordered pairs  Graphical representation  Predicates

9

Injective Functions (one-to-one)

A function f: A B is one-to-one (injective, an

injection) iff f(x) = f(y) x = y for all x and y in the domain of f (xy(f(x) = f(y) x = y))

Equivalently: xy(x y f(x) f(y))

Every b B has at most 1 pre-image

fA B

Page 10: Discrete Mathematics CS 2610 September 12, 2006. 2 Agenda Last class Functions  Vertical line rule  Ordered pairs  Graphical representation  Predicates

10

Surjective Functions (onto)

A function f: A B is onto (surjective, an surjection)

iff yx( f(x) = y) where y B, x A

Every b B has at least one pre-image

fA B

Page 11: Discrete Mathematics CS 2610 September 12, 2006. 2 Agenda Last class Functions  Vertical line rule  Ordered pairs  Graphical representation  Predicates

11

Bijective Functions

A function f: A B is bijective iff it is one-to-one and onto (a one-to-one correspondence)

f

The domain cardinality equals the codomain cardinality

A B

Page 12: Discrete Mathematics CS 2610 September 12, 2006. 2 Agenda Last class Functions  Vertical line rule  Ordered pairs  Graphical representation  Predicates

12

Inverse Functions

Let f : A B be a bijection, the inverse of f,

f -1:B A

such that for any b B,

f -1(b) = a when f (a) = b

A Bf

f-1

Page 13: Discrete Mathematics CS 2610 September 12, 2006. 2 Agenda Last class Functions  Vertical line rule  Ordered pairs  Graphical representation  Predicates

13

Inverse Functions

Let f: A B be a bijection, and f-1:B A be the inverse of f:

f-1 ○ f = IA = (f-1○f)(a) = f-1 (f(a)) = f-1 (b) = a

f ○ f-1 = IB = (f○f-1)(b) = f(f-1 (b)) = f(a) = b

A Bf

f-1

Page 14: Discrete Mathematics CS 2610 September 12, 2006. 2 Agenda Last class Functions  Vertical line rule  Ordered pairs  Graphical representation  Predicates

14

Functions: Real Functions

Given f :RR and g :RR then

(f g): RR, is defined as

(f g)(x) = f(x) g(x)

(f . g): RR is defined as

(f g)(x) = f(x) × g(x)

Example:

Let f :RR be f(x) = 2x and g :RR be g(x) = x3

(f+g)(x) = x3+2x

(f . g)(x) = 2x4