Upload
morgan-holmes
View
233
Download
0
Embed Size (px)
Citation preview
Functions 1
FunctionsElementary Discrete Mathematics
Jim Skon
Functions 2
Functions
Definition: A function consists of three things:1. A non empty set A, called the domain of the
function
2. A non empty set B, called the codomain of the function
3. A rule that assigns to each element of A one and only one, element of B
Functions 3
Function Notations
Use letters such as ƒ, g, and h to denote functions.
ƒ:A B means ƒ is a function with domain A and codomain B
ƒ:A B is read: "ƒ is a function from A to B”
x f(x)
A Bf
Functions 4
Function Notations
If ƒ:A B, and a A and b B, and a is assigned to b by the function ƒ, then we say ƒ(a) = b
If ƒ(a) = b, then the element ƒ(a) or b is called the value of ƒ at a, or the image of a under the function ƒ.
a f(a)=b
A Bf
Functions 5
Function Example Let A = {1,2,3} and B = {a,b,c}
Let ƒ(1) = bƒ(2) = cƒ(3) = a
c is the image of 2 under the function ƒ. The image f(A) of function f is B = {a, b,
c}1
2
3
b
c
a
A B
ƒ
Functions 6
Functions
In general, element a A maps to element ƒ(a) B.
a
A B
ƒ
ƒ(a)
Functions 7
Functions
From rule 3 of the definition, elements of the domain can map to at most one element of the codomain.
Multiple elements of the domain may map to the same element of the range:
1
2
3
b
c
a
A B
ƒ
function
Functions 8
Functions
The domain may not map to multiple elements of the range:
This is called the uniqueness condition of functions
1
2
3
b
c
a
A B
ƒ
not a function
Functions 9
Function
.Formal Definition: Let A and B be sets. A function ƒ:A B is a subset of the Cartesian
product A B, which satisfies the uniqueness condition that, for all (a1, b1) ƒ and (a2, b2) ƒ, if a1 = a2, then b1 = b2.
Functions 10
Function Examples:
Consider again A = {1,2,3} and B = {a,b,c}
Let ƒ(1) = bƒ(2) = cƒ(3) = a
ƒ = {(1, b), (2, c), (3, a) }
Functions 11
Function Examples
Consider ƒ:R R where R is reals
Let ƒ(x) = x2. Alternately: ƒ = {(x, x2) | x R} Then ƒ:R R
Functions 12
Function Examples
Let ƒ:N N where
ƒ(n) = n + 1 for all n N Alternately :ƒ = {(n, n+1) | n N }
Functions 13
Function Examples
Let S be a finite non-empty set. We may define the function:
ƒ:P(S) N as ƒ(A) = |A|.
Alternately: ƒ = {(a, n) | a P(S) n N |a| = n}
This is the set size function.
Functions 14
Function Examples
Consider the function ƒ:N N N
N N are pairs of natural numbers. Let ƒ(x,y) = x2 + y ƒ = {((x,y), x2 + y)}
Functions 15
Function Examples
Consider a function ƒ:P(S) P(S) P(S)
where S = {1, 2, 3, ..., 10} Let ƒ(A,B) = A B ƒ = {((A, B), A B) | A S B S }
This is the union function
Functions 16
Function Examples Consider in general n-ary functions, which are of the form
ƒ:A1 A2 ... An B.
These are called n-ary functions or functions of n variables, and are written:
ƒ(a1, a2, ..., an) = b
Functions 17
Function Examples
Consider a function ƒ:N N N N I
Let ƒ(w, x, y, z) = 2w + 3(xy) - 4z
ƒ = {( (w, x, y, z), 2w + 3(xy) - 4z) }
Functions 18
Function Examples
Consider a function ƒ:A B NA = {x | x is a MVNC basketball player}
B = {x | x is a MVNC basketball game (date)}
Let ƒ(x, y) = points scored by player x in game y
Functions 19
Function Examples
Consider a function ƒ:A B NA = {x | x is a first names}
B = {x | x is a last name}
Let ƒ(x, y) = student x y’s box number.
Not a function! Why?
Functions 20
Function Examples Consider function ƒ:R I where:
ƒ(x) = Largest integer less than or equal to x.
ƒ(x) = xcalled the floor function.
Consider function ƒ:R I where:ƒ(x) = Least integer greater than or equal to x.
ƒ(x) = xcalled the ceiling function.
Functions 21
Function Range
Range Definition: Let ƒ:A B be a function from A (domain) to
B (codomain). The range of ƒ is the set of all elements of B that are mapped to by some element of A, i.e.
range(ƒ) = {b B | b = ƒ(a) for some a A}
In other words, the range of ƒ is the subset of B which the function actually maps to.
Functions 22
Surjective (onto) Function
Let B be the codomain of function ƒ. If range(ƒ) = B, then we say that the function
is onto BA function ƒ:A B is surjective if it is onto
B.In other words, a function is surjective if
every element in the codomain is mapped to.
Functions 23
Surjective FunctionA BRange(f)
A BRange(g)
g
f
Not onto
Ontof:AB
g:AB
Functions 24
Surjective Function
Which of the previous examples are surjective?
Functions 25
Surjective Function
Formally ƒ is surjective if and only if
b a ƒ (a) = b.or
b a (a, b) ƒ
Functions 26
Injective FunctionDefinition: Let ƒ:A B. If no two different elements of
A are assigned to the same element of B by the function ƒ, the function is one-to-one.
More formally if a1 A:a2 A: ƒ(a1) = ƒ(a2) a1 = a2 Then the function is one-to-one.
Contrapositively:a1 A:a2 A:a1 a2 ƒ(a1) ƒ(a2)
Functions 27
Injective FunctionA B
g
f
Not one to one
One to onef:AB
g:AB
f(a1)a1
a2
a3
a4
a5
a6
f(a2)f(a3)f(a4)f(a5)f(a6)
A B
f(a1)a1
a2
a3
a4
a5
a6
f(a2)
f(a3)= f(a4)
f(a5)f(a6)
f(a7)
f(a7)
Functions 28
Injective functions:
If a function is one-to-one then it is injective.
Which of the previous examples are injective?
Functions 29
Example
Let ƒ:N N be defined by: ƒ(n) = n2
Is this surjective? injective?
Let ƒ:I N be defined by: ƒ(n) = n2
Is this surjective? injective?
Functions 30
Bijective Function
Definition - bijective function
If a function is both surjective and injective then it is bijective.
A bijective function is onto and one-to-one.
A bijective function is simply a one-to-one correspondence
Functions 31
Bijective Function
A function ƒ:A B is bijective if and only if
b B:!a A:ƒ(a) = b
Which of the previous examples are bijective?
Functions 32
Function Composition
Let ƒ:A B and g:B CWe can now define a new function, g f, by the
formula:
(gf)(a) = g(ƒ(a))
This is called the composition function of g with ƒ.
Functions 33
Function Composition
a ƒ(a)
ƒ g
gfA B C
g(ƒ(a)) = gf(a)
Functions 34
Function Composition ExampleLet A = {x, y, z} B = {2, 4, 6, 8}
C = {}Let ƒ:A B be defined by:
ƒ(x) = 2, ƒ(y) = 8, ƒ(z) = 4
Let g:B C be defined by:g(2) = , g(4) = , g(6) = g(8) =
Then g ƒ:A C is the function:(g ƒ)(x) = (g( ƒ(x)) = g(2) = (g ƒ)(y) = (g( ƒ(y)) = g(8) = (g ƒ)(z) = (g( ƒ(z)) = g(4) =
Functions 35
Function Composition ExampleLet ƒ:R R be defined by:
ƒ(x) = 2x2 + 4Let g:R R be defined by:
g(x) = 3x - 1Then g ƒ:(x) = g( ƒ(x))
= g(2x2 + 4)= 3(2x2 + 4) - 1= 6x2 + 12 - 1= 6x2 + 11
What is ƒ g:(x)?
Functions 36
Function Composition Example
Let S be a finite set and x S. We can define:
ƒ:P(S) P(S {x})as the function:
ƒ(T) = T {x}, where T S (or T P(S) )
Let g:P(S {x}) N be the function:
g(V) = |V|, where V S {x} (or V P(S {x}) )
Functions 37
Function Composition Example
Then the composition:
g ƒ:P(S) N
is given by
(g ƒ)(T) = (g( ƒ(T))
= g(T {x})
= |T {x}|
= |T| + 1
Functions 38
Function Composition
In general the composition of functions is not communitive,
e.g. ƒ g g ƒ. In fact, if ƒ g is possible, g ƒ is usually
not possible!
Functions 39
Function Composition
For g ƒ to be possible, f must have a codomain which is a subset of the domain of g.
If ƒ:A B and g:C D, then B C.A CB
g
g:CD
f
D
f:AB
Functions 40
Function Composition
Likewise, for ƒ g to be possible, g must have a codomain which is a subset of the domain of f, e.g.
If ƒ:A B and g:C D, then D A.C AD
f
g:CD
g
B
f:AB
Functions 41
Function Composition
Thus for both ƒ g & g ƒ to exist, B C and D A
A CB
g
g:CD
f
D
f:AB
Functions 42
INVERSE of Functions
If ƒ:A B is a bijection, then it is possible to define a function g:B A with the property: If ƒ(a) = b then g(b) = a
A B
g:BA
f:AB
Functions 43
INVERSE of Functions
Such a function g is called the inverse function of ƒ.
It is denoted by the symbol ƒ-1.
A B
f-1:BA
f:AB
If ƒ(a) = b then f-1(b) = a
Functions 44
Example
Let A = {1,2,3} and B = {a,b,c}.Let ƒ:A B be defined by: ƒ(1) = c, ƒ(2) = a, ƒ(3) = bThen the inverse ƒ-1:B A is defined by: ƒ-1(a) = 2, ƒ-1(b) = 3, ƒ-1(c) =
123
cab
A B
f123
cab
A B
f-1
Functions 45
INVERSE of Functions
The the function ƒ:A B has an inverse ƒ-1:B A if and only if it is bijective.
WHY??
Functions 46
INVERSE of Functions
Note that in general
ƒ-1 ƒ(a) = a, for all a in the domain of ƒ
ƒ ƒ-1(b) = b, for all b in the codomain of ƒ
Functions 47
Function Images
Consider a function: :NN, where (x) =2xThe range of the function is: {0, 2, 4, 6, 8, ... }
Functions 48
Function Images
We can also consider the image of the function over a subset of the domain.
Let A = {2, 3, 4, 5, 6}.
(A) is the the image of function over set A, which is:
(A) = {4, 6, 8, 10, 12}If B = {x | 4 < x 10} then
(B) = {10, 12, 14, 16, 18, 20}
Functions 49
Function Images
Image of a function - the elements mapped to over a given subset
Consider ƒ:R R , f(x) = 2x f(R) = Range(R) = R (The range of f). f(I) = I Let A = {1, 4, 6, 9). Then f(A) = {2, 8, 12, 18} f(N) = ? f(R-) = I
Functions 50
Function Images
Definition: Let be a function from set A to set B and let S
be a subset of A (e.g. S A). The image of S is the subset of B that consists
of the images of the elements of S. The image of S is denoted (S), thus:
(S) = { (S) | s S}
Functions 51
Function Images
Consider::RR, where (x) = (x+1)/2If S = {1, 3, 5, 7, 9}, what is (S)?If S = {x | 3 x 6}, what is (S)?What is (N)?What if (Z)?
Functions 52
Example
Consider 12 - 14 on page 70