You are on page 1of 39

Functions

1
Functions
A function f from a set A to a set B is an
assignment of exactly one element of B to each
element of A.
We write f(a) = b if b is the unique element of B
assigned by the function f to the element a of A.

If f is a function from A to B, we write f: AB
(note: Here, has nothing to do with if
then)
2
3
1
2
3
4
5
2
1
0
8
6
4
Thus this is a fuction.
Functions
If f:AB, we say that A is the domain of f and B
is the codomain of f.

If f(a) = b, we say that b is the image of a and
a is the pre-image of b.

The range of f:AB is the set of all images of
elements of A.

We say that f:AB maps A to B.
4
5
1
2
3
4
5
2
1
0
8
6
4
Set A is the domain of the function.
Set B is the codomain of the function.
Set B excluding element 0 is the range of A.
F(1)=4 thus, 4 is the image of 1 and 1 is the pre-
image of 4.

6
Is the relation shown above a function?
NO
Why not??
2 is assigned both 4 and 10
1
2
3
4
5
2
1
0
8
6
4
7
A function I : A -> B can also be defined in terms of a
relation from A to B. A Relation from A to B that
contains one, and only one, ordered pair (a, b) for
every element a E A, defines a function I from A to B.
This function is defined by the assignment I(a) = b,
where (a, b) is the unique ordered pair in the relation
that has a as its first element.
EXAMPLE 2 Let R be the relation consisting of ordered pairs (Abdul, 22),
(Brenda, 24), (Carla, 21), (Desire, 22), (Eddie, 24), and (Felicia, 22), where
each pair consists of a graduate student and the age of this student. What
is the function that this relation determines?
Solution: This relation defines the function I, where with I(Abdul) = 22,
I(Brenda) = 24, I(Carla) = 21, I(Desire) = 22, l(Eddie) = 24, and I(Felicia)
= 22. Here the domain is the set {Abdul, Brenda, Carla, Desire, Eddie,
Felicia}. The codomain contains all possible ages of students. Finally,
the range is the set (21,22, 24).
Let f
1
and f
2
be functions from A to R.
Then the sum and the product of f
1
and f
2
are also functions
from A to R defined by:
(f
1
+ f
2
)(x) = f
1
(x) + f
2
(x)
(f
1
f
2
)(x) = f
1
(x) f
2
(x)

8
Example:
We already know that the range of a function F:
AB is the set of all images of elements aeA.
If we only regard a subset S_A, the set of all
images of elements seS is called the image of S.
We denote the image of S by f(S):
9
Let us look at the following well-known function:
f(Linda) = Moscow
f(Max) = Boston
f(Kathy) = Hong Kong
f(Peter) = Boston

What is the image of S = {Linda, Max} ?
f(S) = {Moscow, Boston}

What is the image of S = {Max, Peter} ?
f(S) = {Boston}
10
Properties of Functions
A function f:AB is said to be one-to-one
(or injective), if and only if it does not map two
distinct elements of A onto the same element of B.

11
We can express that f is one-to-one using
quantifiers as :-
x, yeA (f(x) = f(y) x = y)
12
1
2
3
4
5
2
1
0
8
6
4
For x , y e A f(x)=f(y) only when x= y for all x
and y in A. Thus this is a one to one function.
Properties of Functions

Example:
f:RR
f(x) = x
2

IS the function f(x) one to one??


Ans: f(3) = f(-3), but 3 = -3, so f is not one-to-one.
13
A function f:AB with A,B _ R is called
strictly increasing, if
x,yeA (x < y f(x) < f(y)),
and strictly decreasing, if
x,yeA (x < y f(x) > f(y)).

Obviously, a function that is either strictly
increasing or strictly decreasing is one-to-one.

14
A function f:AB is called onto, or surjective, if and only if for every element
beB there is an element aeA with f(a) = b.
In other words, f is onto if and only if its range is its entire codomain.
A function f: AB is a one-to-one correspondence, or a bijection, if and only if it
is both one-to-one and onto.
Obviously, if f is a bijection and A and B are finite sets, then |A| = |B|.
15
Is f injective?
No.
Is f surjective?
No.
Is f bijective?
No.

16
Linda
Max
Kathy
Peter
Boston
New York
Hong Kong
Moscow
Is f injective?
No.
Is f surjective?
Yes.
Is f bijective?
No.

17
Linda
Max
Kathy
Peter
Boston
New York
Hong Kong
Moscow
Paul
Is f injective?
Yes.
Is f surjective?
No.
Is f bijective?
No.

18
Linda
Max
Kathy
Peter
Boston
New York
Hong Kong
Moscow
Lbeck
Is f injective?
No! f is not even
a function!

19
Linda
Max
Kathy
Peter
Boston
New York
Hong Kong
Moscow
Lbeck
Is f injective?
Yes.
Is f surjective?
Yes.
Is f bijective?
Yes.

20
Linda
Max
Kathy
Peter
Boston
New York
Hong Kong
Moscow
Lbeck Helena
An interesting property of
bijections is that they have an
inverse function.
The inverse function of the
bijection f:AB is the function
f
-1
:BA with
f
-1
(b) = a whenever
f(a) = b.

21
Inversion
22
Example:


f(Linda) = Moscow
f(Max) = Boston
f(Kathy) = Hong Kong
f(Peter) = Lbeck
f(Helena) = New York
Clearly, f is bijective.
The inverse function
f
-1
is given by:
f
-1
(Moscow) = Linda
f
-1
(Boston) = Max
f
-1
(Hong Kong) = Kathy
f
-1
(Lbeck) = Peter
f
-1
(New York) = Helena
Inversion is only
possible for bijections
(= invertible functions)
23
Q-Let I: Z -> Z be such that I(x) = x + 1. Is I invertible, and
if it is, what is its inverse?
Solution: The function I has an inverse
because it is a one-to-one an onto.
y is the image of x, so that y = x + 1. Then
x = y - 1. This means that y - 1 is the unique
element of Z that is sent to y by I.
Consequently,
I
-1
(y) = y - 1.
Composition
The composition of two functions g:AB and f:BC,
denoted by fg, is defined by (fg)(a) = f(g(a)).
This means that first, function g is applied to element
aeA, mapping it onto an element of B, then, function
f is applied to this element of B, mapping it onto an
element of C. Therefore, the composite function maps
from A to C.

24
Example:

f(x) = 7x 4, g(x) = 3x,
f:RR, g:RR

(fg)(5) = f(g(5)) = f(15) = 105 4 = 101

(fg)(x) = f(g(x)) = f(3x) = 21x - 4

25
Note that composition f
o
g cannot be defined
unless the range of g is a subset of the domain of f.


(f
-1
f)(x) = f
-1
(f(x)) = x

The composition of a function and its inverse is
the identity function i(x) = x.
Consequently (f
-1
f)= I
A
and (ff
-1
) = I
B
, where I
A

and I
B
are the identity functions on
the sets A and B, respectively.
That is, (f
-1
)
-1
= f .
26
Composition of a function and its inverse:
The graph of a function f:AB is the set of
ordered pairs {(a, b) | aeA and f(a) = b eB}.

The graph is a subset of AB that can be
used to visualize f in a two-dimensional
coordinate system.

27
28
Q:- Display the graph of the function I(n) = 2n + I from the
set of integers to the set of integers.

Solution: The graph of I is the set of ordered pairs of the
form (n, 2n + I), where n is an integer.
Example:
The floor and ceiling functions map the real numbers onto the
integers (RZ).
The floor function assigns to reR the largest zeZ with z s r,
denoted by r.
Examples: 2.3 = 2, 2 = 2, 0.5 = 0, -3.5 = -4
The ceiling function assigns to reR the smallest zeZ with z > r,
denoted by r(.
Examples: 2.3( = 3, 2( = 2, 0.5( = 1, -3.5( = -3
29
30
Graphs for (a) Floor and (b) Ceiling functions
31
32
Q:-In asynchronous transfer mode (ATM) (a communications
protocol used on backbone networks), data are organized into cells of
53 bytes. How many ATM cells can be transmitted in I minute
over a connection that transmits data at the rate of 500 kilobits per
second?
Solution: In I minute, this connection can transmit 500,00060 =
30,000,000 bits. Each ATM cell is 53 bytes long, which means that it
is 53 . 8 = 424 bits long. To determine the number of cells that can be
transmitted in 1 minute, we determine the largest integer not
exceeding the quotient when 30,000,000 is divided by 424.
Consequently, L30,000,000/424J = 70,754 ATM cells can be
transmitted in 1 minute over a 500 kilobit per second connection.
Example:
33
The pigeonhole principle
Suppose a flock of pigeons fly into a set
of pigeonholes to roost

If there are more pigeons than
pigeonholes, then there must be at least
1 pigeonhole that has more than one
pigeon in it

If k+1 or more objects are placed into k
boxes, then there is at least one box
containing two or more of the objects
This is Theorem 1
34
In a group of 367 people, there must be
two people with the same birthday
As there are 366 possible birthdays

In a group of 27 English words, at least
two words must start with the same letter
As there are only 26 letters

35
If N objects are placed into k
boxes, then there is at least one
box containing N/k( objects
This is Theorem 2
36
Generalized pigeonhole
principle examples
Among 100 people, there are at least
100/12( = 9 born on the same month

How many students in a class must
there be to ensure that 6 students get
the same grade (one of A, B, C, D, or F)?
The boxes are the grades. Thus, k = 5
Thus, we set N/5( = 6
Lowest possible value for N is 26
37
A bowl contains 10 red and 10 yellow balls
a) How many balls must be selected to ensure 3 balls
of the same color?
One solution: consider the worst case
Consider 2 balls of each color
You cant take another ball without hitting 3
Thus, the answer is 5
Via generalized pigeonhole principle
How many balls are required if there are 2 colors, and one
color must have 3 balls?
How many pigeons are required if there are 2 pigeon holes,
and one must have 3 pigeons?
number of boxes: k = 2
We want N/k( = 3
What is the minimum N?
N = 5
38
39