Upload
gerard-anthony
View
220
Download
0
Tags:
Embed Size (px)
Citation preview
1
Discrete Maths
• Objectivesto show the connection between
relations and functions, and to introduce some functions with useful, special properties
242-213, Semester 2, 2014-2015
6. Functions
1. What is a Function?A function is a special kind or relation
between two sets: f : A B
2
A
f
B
domain codomain
All the elements in Ahave a single link to a value in B
Some elements in Bmay not be used. Somemay be used more thanonce.
read this as f maps A to B;it is NOT if-then
ExampleThe function f: P C with
P = {Linda, Max, Kathy, Peter}C = {Hat Yai, NY, Hong Kong, Bangkok}
Usual function notation:f(Linda) = Hat Yaif(Max) = Hat Yaif(Kathy) = Hong Kongf(Peter) = Bangkok
3
Linda
Max
Kathy
Peter
Bangkok
Hong Kong
NY
Hat Yai
P C
f
The range is the set of elements in B used by the function f.
4
the range
Range
A
f
B
2. Functions with Special PropertiesFunction ImageOne-to-one Function (injective)Onto Function (surjective)One-to-one Correspondence (bijective)Identity FunctionInverse Function
5
2.1. Function Image, f(S)
6
A
f
B
For some subset of A (e.g. S), the set of f() values in B are itsFunction Image f(S).
S A
f(S)
2.2. One-to-one Function
7
also calledinjective
A
f
B
Each value in A maps to one value in B.
Don’t need touse all the B values.
Examples
8
f(Linda) = Moscowf(Max) = Bostonf(Kathy) = Hong Kongf(Peter) = Boston
Is f one-to-one?
No, Max and Peter are mapped onto the same element of the image
g(Linda) = Moscowg(Max) = Bostong(Kathy) = Hong Kongg(Peter) = New York
Is g one-to-one?
Yes, each element is assigned a unique element of the image
2.3. Onto Function
9
also calledsurjective
A
f
B
Every element in B is linked to from A.
Some elements in Bmay be used more than once.
2.4. One-to-one Correspondence
10
also calledbijective
A
f
B
Each value in A maps to one value in B andevery element in B is linked to from A.
bijective == injective + surjective
Is f injective?No
Is f surjective?No
Is f bijective?No.
11
Example 1
Linda
Max
Kathy
Peter
Boston
New York
Hong Kong
Moscow
f
injective: 1-1; not all Bsurjective: all Bbijective 1-1; all B
Is f injective?No
Is f surjective?Yes
Is f bijective?No
12
Example 2
Linda
Max
Kathy
Peter
Boston
New York
Hong Kong
Moscow
f
Paul
injective: 1-1; not all Bsurjective: all Bbijective 1-1; all B
Is f injective?Yes
Is f surjective?No
Is f bijective?No
13
Example 3
injective: 1-1; not all Bsurjective: all Bbijective 1-1; all B
Linda
Max
Kathy
Peter
Boston
New York
Hong Kong
Moscow
f
Lubeck
Is f injective?No!
f is not evena function
14
Example 4
injective: 1-1; not all Bsurjective: all Bbijective 1-1; all B
Linda
Max
Kathy
Peter
Boston
New York
Hong Kong
Moscow
f
Lubeck
Is f injective?Yes
Is f surjective?Yes
Is f bijective?Yes
15
Example 5
injective: 1-1; not all Bsurjective: all Bbijective 1-1; all B
Linda
Max
Kathy
Peter
Boston
New York
Hong Kong
Moscow
f
Lubeck
bijective == injective + surjective
Paul
2.5. Identity Functionf : X X is called the identity function (Ix) if every
element in X is mapped to the same elemente.g.
16
12
3
4
:
Z+
12
3
4
:
Z+f(x) = x * 1f
2.6. Inverse Function
17
Linda
Max
Kathy
Peter
Boston
New York
Hong Kong
Moscow
f
LubeckPaul
Linda
Max
Kathy
Peter
Boston
New York
Hong Kong
Moscow
f-1
LubeckPaul
example 5
• If f is bijective then we can create an inverse function, f-1
• if f(x) = y then f-1(y) = x
18
f(Linda) = Moscowf(Max) = Bostonf(Kathy) = Hong Kongf(Peter) = Lübeckf(Paul) = New York
f-1(Moscow) = Lindaf-1(Boston) = Maxf-1(Hong Kong) = Kathyf-1(Lübeck) = Peterf-1(New York) = Paul
Inversion is only possible for bijective functions.
3. Composition of Functionsif g: X Y and f: Y Z then f g: X Z
read as “first do g then do f”
The composition of f and g is defined as: (f g)(x) = f( g(x) )this is why f and g are ordered this way
19
Diagram
f g is only possible if the range of g is a subset of the domain of f
20
X
Y
Z
gf
f g
f’s domaing’s range
Examplef(x) = 7x – 4, g(x) = 3x
(f g)(5) = f( g(5) ) = f(15) = 105 – 4 = 101
In general:(f g)(x) = f( g(x) ) = f(3x) = 21x - 4
21
Composition and Inverse (f-1 ○ f)(x) = f-1(f(x)) = x
The composition of a function and its inverse is the identity function ix
22
4. More Information
• Discrete Mathematics and its ApplicationsKenneth H. RosenMcGraw Hill, 2007, 7th edition• chapter 2, section 2.3
23