Functions
Functions
1
• In discrete mathematics, a function is a
relation that associates each element from
one set called the (domain) to exactly one
element in another set ‘- called the
(codomain).
𝑓
• F is a mapping from to
• If ‘-
• then b is called the image of a under
• is called the preimage of
• The range (or image) of f is the set of all images of points in A.
We denote it by
4
Example
• The domain ofis
• The codomain of is
A B
• The image ofis a
x
‘- b
• The preimage ofis y
c
• The preimage of is z
d
• The range/image of is
5
Representing functions
• Functions may be specified in different ways:
1. An explicit statement of the assignment.
• Students and grades example.
2. A formula ‘-
3. A computer program
• A java program that when given an integer , product
the Fibonacci Number.
6
Injections
7
INJECTIONS NOT INJECTIONS
A B A B A B
a x a x a x
b v b v b v
‘-
y c y c y
c
d z d z d
8
Surjections
9
SURJECTION NOT SURJECTION
A B A B A B
a x a x a x
b v b v b v
‘-
c y c y c y
d d z z
10
Injections + Surjections
‘-
=
Bijections
11
Bijections
• Definitions : A function is a one-to-one
correspondence, or a bijection,‘- if it is both one-to-
one and onto (surjective and injective)
• Invertible
12
BIJECTION NOT BIJECTION
A B A B
a x
a x
b v
b v ‘-
y c y
c
d z
d z
13
Showing that f is/is not injective or
surjective
• Consider a function
• is injective if:
• is surjective iff:
−1
𝑓 ( 𝑏)
‘-
𝑎= 𝑓
−1
(𝑏) 𝑏= 𝑓 (𝑎)
A B
15
• Example 1:
• Let be the function from
17
• Example 3:
• Let be such that
• Is invertible and if so what is its inverse?
• Solution
‘-
• The function is invertible because it is a
bijection
• reverse the correspondence:
18
Composition
• Definition: Let The composition of with , denoted is the function from defined by
‘-
19
g f
A B C A C
a h
v
b
i
w ‘-
c
j
x
d
y
20
• Example: if
then
‘-
and
+1
21
Graphs of Functions
• Let be a function from the set to the set The graph of the function is the set
of ordered pairs
‘-
22
Some Important Functions
• The floor function, denoted
23
‘-
24
Factorial Function
• Definition: denoted by is the product of the first positive
integers:
‘-
• Examples:
y
25
THANK YOU! ‘-
26