Top Banner
Functions
20

Functions

Mar 22, 2016

Download

Documents

jaeger

Functions. Functions. Definition : A function f from set A to set B , denoted f : A → B, is an assignment of each element of A to exactly one element of B . We write f ( a ) = b if b is the unique element of B assigned to the element a of A . . - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Functions

Functions

Page 2: Functions

FunctionsDefinition: A function f from set A to set B,

denoted f: A→B, is an assignment of each element of A to exactly one element of B.

We write f(a) = b if b is the unique element of B assigned to the element a of A.

A

B

C

Students Grades

D

FKathy Scott

Sandeep Patel

Carlota Rodriguez

Jalen Williams

Functions are also called mappings

Page 3: Functions

FunctionsGiven a function f: A → BA is called the domain of fB is called the codomain of ff is a mapping from A to BIf f(a) = b

then b is called the image of a under fa is called the preimage of b

The range (or image) of f is the set of all images of points in A. We denote it by f(A).

Page 4: Functions

ExampleA Ba

b

c

d

x

y

z

The domain of f is AThe codomain of f is BThe image of b is y

f(b) = yThe preimage of y is bThe preimage of z is {a,c,d}The range/image of A is

{y,z}f(A) = {y,z}

Page 5: Functions

Representing FunctionsFunctions may be specified in different ways:

1. An explicit statement of the assignment. Students and grades example.

2. A formula. f(x) = x + 1

3. A computer program. A Java program that when given an integer n,

produces the nth Fibonacci Number

Page 6: Functions

InjectionsDefinition: A

function f is one-to-one, or injective, iff a ≠ b implies that f(a) ≠ f(b) for all a and b in the domain of f.

v

w

A Ba

b

c

d

x

y

z

Page 7: Functions

SurjectionsDefinition: A

function f from A to B is called onto or surjective, iff for every element b ∈ B there exists an element a ∈ A with f(a) = b

A Ba

b

c

d

x

y

z

Page 8: Functions

BijectionsDefinition: A function

f is a one-to-one correspondence, or a bijection, if it is both one-to-one and onto (surjective and injective)

A Ba

b

c

d

x

y

z

w

Page 9: Functions

Showing that f is/is not injective or surjectiveConsider a function f: A → Bf is injective iff: ∀x,y ∈ A ( x ≠ y → f(x) ≠ f(y) )f is not injective iff: ∃x,y ∈ A ( x ≠ y ∧ f(x) = f(y) )f is surjective iff: ∀y ∈ B ∃x ∈ A ( f(x) = y )f is not surjective iff: ∃y ∈ B ∀x ∈ A (f(x) ≠ b)

Page 10: Functions

Inverse FunctionsDefinition: Let f be a bijection from A to B. Then

the inverse of f, denoted f –1, is the function from B to A defined as

No inverse exists unless f is a bijection.

Page 11: Functions

Inverse FunctionsExample 1:

Let f be the function from {a,b,c} to {1,2,3} f(a)=2, f(b)=3, f(c)=1. Is f invertible and if so what is its inverse?

Solution: f is invertible because it is a bijectionf –1 reverses the correspondence given by f:f –1(1)=c, f –1(2)=a, f –1(3)=b.

Page 12: Functions

Inverse FunctionsExample 2:

Let f: R → R be such that f(x) = x2 Is f invertible, and if so, what is its inverse?

Solution: The function f is not invertible because it is

not one-to-one

Page 13: Functions

Inverse FunctionsExample 3:

Let f: Z Z be such that f(x) = x + 1Is f invertible and if so what is its inverse?

Solution: The function f is invertible because it is a bijection f –1 reverses the correspondence: f –1(y) = y – 1

Page 14: Functions

CompositionDefinition: Let f: B → C, g: A → B. The

composition of f with g, denoted f ∘ g is the function from A to C defined by

Page 15: Functions

Composition

A CA B Ca

b

c

d

v

w

x

y

g

h

j

i

f

a

b

c

d

i

j

h

Page 16: Functions

CompositionExample: If and

then

and

Page 17: Functions

Graphs of FunctionsLet f be a function from the set A to the set B.

The graph of the function f is the set of ordered pairs

{(a,b) | a ∈A and f(a) = b}Graph of f(n) = 2n+1 from Z to Z

Graph of f(x) = x2 from Z to Z

Page 18: Functions

Some Important FunctionsThe floor function, denoted

is the largest integer less than or equal to x.The ceiling function, denoted

is the smallest integer greater than or equal to xExamples:

Page 19: Functions

Some Important FunctionsFloor Function (≤x) Ceiling Function (≥x)

Page 20: Functions

Factorial Function Definition: f: N → Z+, denoted by f(n) = n! is

the product of the first n positive integers:f(n) = 1 ∙ 2 ∙∙∙ (n–1) ∙ n for n>0f(0) = 0! = 1

Examples:f(1) = 1! = 1f(2) = 2! = 1 ∙ 2 = 2f(6) = 6! = 1 ∙ 2 ∙ 3 ∙ 4 ∙ 5 ∙ 6 = 720f(20) = 2,432,902,008,176,640,000