Functions
Functions
presented by-
Devi Prasanna
1
Definition of a function
• A function is a special relationship between two
sets, called the domain and the codomain.
• Each element in the domain is mapped to exactly one
element in the codomain.
• This mapping is represented by an input-output
rule, often written as f(x) = y, where x is the input and
y is the output.
2
Function terminology
f maps R to Z
R f Z
Domain Co-domain
f(4.3)
4.3 4
4
Injective function
• An injective function, also known as a one-to-one
function, is a function where each input has a unique
output.
• In other words, no two different inputs in the domain
can map to the same output in the codomain.
5
Injective functions
• A function is injective if each element in the co-
domain has a unique pre-image
– Meaning no 2 values map to the same result
a 1 a 1
e 2 e 2
i 3 i 3
o 4 o 4
5 5
in the co-domain i 3
o 4
5
A one-to-one function
7
Examples of injective functions:
• f(x) = x (the identity function)
• f(x) = x^2 (for non-negative inputs)
• f(x) = sin(x)
8
Surjective function
• A surjective function, also known as an onto
function, is a function where every element in
the codomain is mapped to by at least one
element in the domain.
• In other words, for every output in the
codomain, there exists at least one input in the
domain that produces that output
9
surjective functions
• A function is onto if each element in the co-
domain is an image of some pre-image
– Meaning all elements in the right are mapped to
a 1 a 1
e 2 e 2
i 3 i 3
o 4 o 4
u 5
elements in the i 3
o 4
co-domain
u
An onto function
11
Examples of surjective functions
• f(x) = x^2 (for all real numbers)
• f(x) = sin(x)
• f(x) = |x|
12
Onto vs. one-to-one
• Are the following functions onto, one-to-one,
both, or neither?
a 1 a 1
a 1
b 2 b 2
b 2
c 3 c 3
c 3
4 d 4
4
1-to-1, not onto Both 1-to-1 and onto Not a valid function
a 1 a 1
b 2 b 2
c 3 c 3
d d 4
Onto, not 1-to-1 Neither 1-to-1 nor onto 13
Bijective Functions
• A bijective function is a function that is both injective
and surjective.
• In other words, it is a function where each input has a
unique output, and every output is produced by at
least one input
14
Bijections
• Consider a function that is a 1
b 2
both one-to-one and onto:
c 3
d 4
• Such a function is a one-to-one correspondence,
or a bijection
15
Examples of bijective functions
• f(x) = x (the identity function)
• f(x) = x^2 (for non-negative inputs)
• f(x) = sin(x)
16
Thankyou…..
17