functions. let a and b be sets a function is a mapping from elements of a to elements of b and is a...
TRANSCRIPT
![Page 1: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/1.jpg)
Functions
![Page 2: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/2.jpg)
Let A and B be sets• A function is
• a mapping from elements of A• to elements of B
• and is a subset of AxB• i.e. can be defined by a set of tuples!
BAf :
)]],[[ fyxByyAxx
What’s that?
![Page 3: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/3.jpg)
Let A be the set of women • {Andrea,Mary,Betty,Susie,Bervely}
Let B be the set of men• {Phil, Andy, Ian, Dick, Patrick,Desmond}
f: A -> B (i.e. f maps A to B)• f(a) : is married to … delivers husband
f = {(Andrea,Patrick),(Beverly,Phil), (Susie,Dick), (Mary,Ian),(Betty,Andy)}
Example of a function
![Page 4: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/4.jpg)
Example of a function
•Andrea•Mary•Betty•Susie•Beverly
•Phil•Andy•Ian•Dick•Patrick•Desmond
Domain Codomain
A value in the domain maps to only one value in codomainotherwise it is not a function
F(Andrea) = Patrick• Patrick is the image of Andrea• Andrea is the preimage of Patrick
![Page 5: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/5.jpg)
![Page 6: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/6.jpg)
BAf :
• A is the domain • B is codomain•f(x) = y
• y is image of x• x is preimage of y
• There may be more than one preimage of y• marriage? Wife of? A man with many wives? Kidding?
• There is only one image of x• otherwise not a function
• There may be an element in the codomain with no preimage• Desmond ain’t married
• Range of f is the set of all images of A• the set of all results• f(A) = {Patrick,Ian,Phil,Andy,Dick}
• the image of A = {Andrea,Mary,Beverly,Betty,Susie}
![Page 7: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/7.jpg)
The image of a set S
}|)({)( SxxfSf
F({Andrea,Mary,Beverly})={Ian,Patrick,Phil}
![Page 8: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/8.jpg)
Another Function
),...}16,4(),9,3(),4,2(),1,1(),0,0{(
)(
:2
f
xxf
NNf
0
10
20
30
40
50
60
0 2 4 6 8
x
x sq
uare
d
x squaredA function has a graph!
![Page 9: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/9.jpg)
Another Function
),...}16,4(),9,3(),4,2(),1,1(),0,0{(
)(
:2
f
xxf
NNf
Notice that we can have an “explicit” representation of a function as a set of tuples (in this case “pairs”) … and wehave already said so
NNf
![Page 10: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/10.jpg)
We can add and multiply functions
… so long as they have the same domains and codomains
“domain” on the left hand side“codomain” on the right hand side (set of results)
![Page 11: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/11.jpg)
Adding and multiplying functions
)()())(( 2121 xfxfxff
)()())(( 2121 xfxfxff
21 )( xxf xxf 2)(2
xxxff 2))(( 221
321 2))(( xxff
![Page 12: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/12.jpg)
Types of functions• injection• strictly increasing/decreasing• surjection• bijection
![Page 13: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/13.jpg)
Injection (aka one-to-one, 1-1)
]))()([( yxyfxfyx
a
b
c
d
x
y
z
winjection
a
b
c
d
x
y
z
not an injection
If an injection then preimages are unique
![Page 14: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/14.jpg)
Injection (aka one-to-one, 1-1)
abc
d
x
y
z
winjection
If f:AB injective (1-1) then AB
)},(),,(),,(),,{( wdzcxbyaf
]))()([( yxyfxfyx
![Page 15: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/15.jpg)
Strictly increasing/decreasing
• strictly increasing • if x y then f(x) f(y)
• strictly decreasing• if x > y then f(x) > f(y)
Note: must therefore be 1-1 (i.e. f(x) = f(y) x=y)
![Page 16: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/16.jpg)
OnTo/Surjective
f:AB is onto/surjective iff for every element b B there isan element a A such that f(a) = b
])([ yxfAxBy
Each value in the codomain has a preimage
abc
d
x
y
z
w
surjection
e
abc
d
x
y
z
w
Not a surjection
e
![Page 17: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/17.jpg)
OnTo/Surjective
Is this onto/surjective?
f:AB whereA = {a,b,c,d}B = {1,2,3}f = {(a,3),(b,2),(c,1),(d,3)}
Each value in the codomain has a preimage
abcd
x
y
zw
surjection
e
abcd
x
yzw
Not a surjection
e
)},(),,(),,(),,(),,{( zewdzcxbyaf
|||| then ctiveonto/surje if BA
![Page 18: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/18.jpg)
Is the function marriedTo(x) surjective? injective?
Men Women :marriedTo
![Page 19: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/19.jpg)
Bijection (1-1 correspondence)
f is a bijection iff it is both 1-1 and onto
• f(a) = f(b) a = b (1-1)• each element of codomain has a preimage (onto)
])([))()(( bafAaBbabyxyfxfyx
abc
d
x
y
z
w
bijection
BAf :
BA
![Page 20: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/20.jpg)
Summary
•1-1/injection/one-to-one• f(a) = f(b) a = b• codomain is at least as large as domain
• onto/surjection• every element of codomain has a preimage
• bijection• 1-1 and onto• domain and codomain same size
![Page 21: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/21.jpg)
For the class
Given the following functions state if they are injections (1-1),surjections, or bijections.
2)( where: xxfZZf
integerseven ofset theis E where 2)( whereE: xxfZg
2 x)( whereZ: xfZh
pperson of code postal )(2 where C:2
ppcpPpcp
![Page 22: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/22.jpg)
Inverse of a function
1f
![Page 23: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/23.jpg)
Invertable functions
bafBAf
)(:
abfABf
)(:
1
1
abfbaf )()( 1
aaff ))((1
For inverse to exist function must be a bijection
![Page 24: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/24.jpg)
Composition
gf
The composition of f with g
![Page 25: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/25.jpg)
Composition
If g:AB and f:BC then (f g)(x) = f(g(x))
Can only compose functions f and g if the range of g is a subset of the range of f
![Page 26: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/26.jpg)
Composition … an example
Let g be the function from student number numbers to studentLet f be the function from students to postal codes
(f g)(a) = f(g(a))
delivers the postal code corresponding to a student number
Note: A is set of student numbersB is set of studentsC is set of postal codes
![Page 27: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/27.jpg)
Composition … an other example
32)( xxf 2)( xxg
32)())(())((
2
2
xxfxgfxgf
9124)32(
))(())((
2
xxxgxfgxfg
![Page 28: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/28.jpg)
For the class
g:AA where A={a,b,c} and g = {(a,b),(b,c),(c,a)}
f:AB where B={1,2,3} and f = {(a,3),(b,2),(c,1)}
give compositions f g and g f
17
![Page 29: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/29.jpg)
Two important functions
xinteger largest )( xxfloor
xinteger smallest )( xxceiling
![Page 30: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/30.jpg)
Two important functions
xinteger largest )( xxfloor
xinteger smallest )( xxceiling
97.9
107.9
A man can lift 10 units of weightHow many men do we need to lift 81 units?
![Page 31: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/31.jpg)
[floor(x:float) : integer -> integer!(x)]//// The largest integer that is less than or equal to x// (a) If x >= 0 this amounts to truncation beyond the decimal point// (b) If x < 0 (negative) // then if there is anything after the decimal then// truncate and then subtract 1 (i.e. -0.001 becomes -1)//
Floor xxfloor )(
![Page 32: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/32.jpg)
[ceiling(x:float) : integer -> if (float!(floor(x)) < x) floor(x) + 1 else floor(x)]//// The smallest integer that is greater than x// eg. ceiling(3.1) = 4, ceiling(-3.1) = -3//
Ceiling
xxceiling )(
![Page 33: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/33.jpg)
Get a Headache
xxf
ENf
N
E
2)(
:
},3,2,1,0{
},8,6,4,2,0{
So, every element in the domain maps to one element in the codomainEvery element in codomain has unique pre-imageThe function is bijectiveTherefore cardinality of N is same as cardinality of EWhat?
0
1
2
3
1
nn
0
2
4
6
)1(2
2
n
n
![Page 34: Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!](https://reader035.vdocument.in/reader035/viewer/2022081513/56649dd05503460f94ac4d5c/html5/thumbnails/34.jpg)
fin