Functions
→ Given sets A and B a function from A to B is a rule f
,
that associates each element of A with exactly one
element of B
A
↳ B
•
: :#
→ if f associates set A with
y
C- B then
,
we write
1- In) f- maps
' '
y or n to
y
=
→
if f- is a function from A to B ,
we write
f- : A → B
→ we call it the domain off and B the codomain off
→
every
element of the domain has to be
mapped
somewhere in the codomain ( but not the other
way
around)
→ An element from domain cannot be mapped to more
than one element in co domain .
Let A =
{ a
,
b
,
c
} and B =
{ 1
,
2
,
3
}
1- : A → B where
f- (a) = 1
,
f- (b) = 1
,
f (c) =
2
Can be described using arrows
A B
a.
C
:# ÷
•
or a
graph
B
n
2 •
I • •
> A
a b e
→ function can have I rule
f- ( N ) = 6N + 28
or it can be described using case distinction
(n ) ? if odd
{
2 n is
g.
=
.
3nF n + 1 ,
if n is even
→ function rule does not have to be a formula
I (E) = E 's left ear
Useful functions
floor function L ] R Z b- real number x
assigns
→
any
:
→
the
largest integer that is ≤ x
e.
g L Ya J = 0
R→ real number
→
Ceiling function r 7 : 2-
assigns
to
any se
the smallest integer ≥ se
e.
g Mts 7 = I
L set ≤ a ≤ Fail a set 1
a- I <
L -
X J = - MT
n7 L N )
r
-
- =
→ If the domain of a function f is a Cartesian product
that f has
A ,
× . - - ✗ An
,
we
say arity f is any n
,
an n -
function or
f has n
arguments
→ In this case , for each n -
tuple ( n , ,
- - -
, Mn ) C- Aix - - -
✗ An
,
1- ( M , ,
-
.
. .
, Nn)
denotes the value of fat ( x , ,
- . -
, Nn)
Same
↑
as
f- ( (N , ,
- -
.
Yn))
called
→
function with 2
arguments is a
binary function
we also have the option of writing f- In , g) = Z in the form
sefy = Z
→ A tuple can be
thought of as a function
e.
g the
5- tuple ( 22 14,55 700 ) can be,
the values of the function f :{ 0,1 2,3 , 4 }
,
1
,
thought of Nas
a
listing of , →
defined by
1- ( O) = 22
,
Fl D= 14 , fl 2) =
55,1-1 3) = 1
,
f (4) = 700
→
similarly an infinite sequences can also be
thought of as a function
e-
g suppose (
b o ,
b,
,
. .
_
,
bn ,
. . .
) is an infinite sequence of
objects from a set S
listing of the values of
.
This sequence can be thought of as a
the function f : N → S defined by
f- ( n ) =
bn
Functions are
special Binary Relations
→
f : A - B { ( a. b) C- A ✗
B) f /a) b) =
→
Only true if :
1) for a
c- A there is some b EB with la b) being in the
every
relation
,
2) No two ordered
pairs in the relation have the same first
element .
Properties of Functions
→ A function f A B is called one to one ( injective
: → )
if it maps distinct elements of A to distinct elements of B
→ A function f : A → B is called onto (surjective) if every
element b in B can be obtained as b=f (a) for some a
in A .
↳ the
range of
the function can be a
proper
subset of A
range (f) = 9 fla) C- B) a C- A }
→ When function is both it is called bijective
→
Bijection s always come in pairs
if f- : A → B is bijection then there is a function
a
,
A called the inverse of 7 defined by
'
f- :B →
f- I a) b
'
F- (b) = a whenever =
f- ( fla ) ) for every
'
=
a a c- A
→ for every
set A its
, identity function ida : A → A is defined
by for all a C- A
id , (a) = a
then ida is a bijection and its inverse is itself
→ let s be a set .
for every subset A ≤ s its characteristic
function fa :S →
{ 0,1 } is defined by for all NES , ,
if x EA
{
1
fn.tn/-- 0
.
if n¢A
,
→
Say if AIN then fa : N →
go it ,
can be represented by an
infinite 0-1 sequence .
Describing N→N functions by recursion
→ e.
g factorial function
Basis : f- 101=1 and f 4) = 1
Recursive : if n> 1 then fln ) f- In
= -
1) • n
→
fibonacci function
Basis : f- 101--0 and f- 41--1
Recursive : if n> 1 then fcn) =
f- In 2) + f- In D
-
-
combining functions
→ let
g
: A → B and f :B → C be functions
the composition off and g is the function (fog) : A → C
defined by
4- g) (a) ◦ =
flag (a) ) for each a c- A
→
g
to
A B C
-
fog
→ We
only define composition fog when
codomain of g = domain of f
Properties of composition
→ Evenif both are defined fog and goof be different
,
can
let f and
g
be both E z functions defined by flat
→
,
-3
n'
and then
g (a)
= but 2
fog ( ) n = Cent 7-
6Mt 11
g. of (a)
=
→ f- ( gob)
◦ =
to g) oh
→
if f : A → B is a
bijection then
'
f- of = i da and f f ◦
"
= id
B
→
for any function f A → B :
,
f- ida i do f- f •
= •
horn table sets
→ if finite sets have the same number of elements then ,
there is
always a
bijection between them
→ A set is countable if it is finite or there is a
bijection
between A and N
e -
N N bijection N countable
idn : →
is a
,
is
→ Not all sets are countable