You are on page 1of 45

Lecture 10,11,12,13,14,15

RELATIONS AND FUNCTIONS:


• In mathematics, a function is a relation between a set of inputs and a set of
permissible outputs with the property that each input is related to exactly one
output.(Wikipedia).
• A function F from a set X to a set Y is a relation from X to Y that satisfies the
following two properties
• 1. For every element x in X, there is an element y in Y such that (x,y) ∈F.
• In other words every element of X is the first element of some ordered pair of F.
• 2. For all elements x in X and y and z in Y, if (x,y) ∈F and (x,z) ∈F, then y = z
• In other words no two distinct ordered pairs in F have the same first element.
• Which of the relations define functions from X = {2,4,5} to Y={1,2,4,6}.
• a. R1 = {(2,4), (4,1)}
• b. R2 = {(2,4), (4,1), (4,2), (5,6)}
• c. R3 = {(2,4), (4,1), (5,6)}
• SOLUTION :
• a. R1 is not a function, because 5 ∈X does not appear as the first
element in any ordered pair in R1.
• b. R2 is not a function, because the ordered pairs (4,1) and (4,2) have
the same first element but different second elements.
• c. R3 defines a function because it satisfy both the conditions of the
function that is every element of X is the first element of some order
pair and there is no pair which has the same first order pair but
different second order pair.
• A FUNCTION f from a set X to a set Y is a relationship between
elements of X and elements of Y such that each element of X is
related to a unique element of Y, and is denoted f : X →Y. The set X is
called the domain of f and Y is called the co-domain of f.

• Functions are sometimes also called mappings or transformations.


RANGE OF A FUNCTION:

• Let f: X→Y. The range of f consists of those elements of Y that are


image of elements of X.
• Symbolically: Range of f = {y ∈Y| y = f(x), for some x ∈X}
• NOTE:
• 1. The range of a function f is always a subset of the co-domain of f.
• 2. The range of f: X →Y is also called the image of X under f.
• 3. When y = f(x), then x is called the pre-image of y.
• 4. The set of all elements of X, that are related to some y ∈Y is called
the inverse image of y.
SOLUTION:

1. Range of f = {1, 6}
2. Range of g = {1, 2, 6}
3. Range of h = {1, 4}
Image and pre image of Function

Two functions are equal when they have the same domain, have the same codomain,
and map each element of their common domain to the same element in their common
codomain.
Example
• What are the domain, codomain, and range of the function that assigns grades
to students described in the first paragraph of the introduction of this section?
• suppose that each student in a discrete mathematics class is assigned a letter
grade from the set {A,B,C,D, F}. And suppose that the grades are A for Adams,
C for Chou, B for Goodfriend, A for Rodriguez, and F for Stevens.
• Solution: Let G be the function that assigns a grade to a student in our discrete
mathematics class. Note that G(Adams) = A, for instance. The domain of G is
the set {Adams, Chou, Goodfriend, Rodriguez, Stevens}, and the codomain is
the set {A,B,C,D, F}. The range of G is the set {A,B,C, F}, because each grade
except D is assigned to some student.
• A function is called real-valued if its codomain is the set of real
numbers, and it is called integer-valued if its codomain is the set of
integers.
• Two real-valued functions or two integer valued functions with the
same domain can be added, as well as multiplied.
Function
A function f from set A to set B is a relation (rule of
correspondence) that assigns each element x in the set
A to exactly one element y in the set B.

1 2 No
xh
a re 2 4 tha as
x ’s ed n o
mo
3
All sign 6 ass ne re
i gn y
as 4 8 ed
5 10

Set A is the domain Set B is the Codomain

1). Must use all the 2). The x value can only be
x’s in A. assigned to one y in B.
Function (Arrow diagrams)
If X and Y are finite sets, you can define a function f from X to Y
by drawing an arrow diagram. You make a list of elements in X
and a list of elements in Y, and draw an arrow from each element
in X to the corresponding element in Y.
Functions and non functions
Which of the arrow diagrams define functions from
X = {a, b, c} to Y = {1, 2, 3, 4}? Self Test Excersice

A= not function b=not function c= function


One-to-One Functions
Some functions never assign the same value to two different domain
elements. These functions are said to be one-to-one
Example
• Determine whether the function f from {a, b, c, d} to {1, 2, 3, 4, 5} with f (a) = 4,
f (b) = 5,f (c) = 1, and f (d) = 3 is one-to-one.
• Solution = self test
• Determine whether the function f (x) = x2 from the set of integers to the set of
integers is one-to-one.
• Solution: The function f (x) = x2 is not one-to-one because, for instance,
f (1) = f (−1) = 1, but 1 = −1.
• Note that the function f (x) = x2 with its domain restricted to Z+ is one-to-one.
• EXAMPLE Suppose that each worker in a group of employees is assigned a job
from a set of possible jobs, each to be done by a single worker. In this situation,
the function f that assigns a job to each worker is one-to-one. To see this, note
that if x and y are two different workers, then f (x) = f (y) because the two
workers x and y must be assigned different jobs.
One-to-One Functions

1 5

2 6

3 7

4 8

5 9

Dom (R) = {1, 2, 3, 4, 5} Codomain(R)={5, 6, 7, 8, 9,10}


Function (Inverse Image)
Definition
Onto Functions / Surjective function
• A surjective function is a function whose image is equal to its codomain. Equivalently, a
function f with domain X and codomain Y is surjective if for every y in Y there exists at
least one x in X with f(x)=y
OR
• In mathematics, a function f from a set X to a set Y is surjective (or onto), or a surjection,
if for every element y in the codomain Y of f there is at least one element x in the domain
 X of f such that f(x) = y.
• It is not required that x is unique; the function f may map one or
• more elements of X to the same element of Y. (Wikipedia)
OR
• Let f: X→Y be a function. f is surjective or onto if, and only if,
∀ y ε Y, ∃ x εX such that f(x) = y.
• That is, f is onto if every element of its co-domain is the image of some
element(s) of its domain.i.e., co-domain of f = range of f
Onto Functions on Sets
Onto Functions on Sets
Onto Functions on Sets
Identifying Onto Functions
Onto Functions
Example 1

Let f be the function from {a, b, c, d} to {1, 2, 3}


defined by f (a) = 3, f (b) = 2, f (c) = 1, and f (d) = 3.
Is f an onto function?

Example 2

Is the function f (x) = x2 from the set of integers to


the set of integers onto?
Some Examples
One-to-One Correspondence (Bijection)
BIJECTIVE FUNCTION or ONE-TO-ONE CORRESPONDENCE
• The function f is a one-to-one correspondence, or a bijection, if it is both
one-to-one and onto. We also say that such a function is bijective.
• A function f: X→Y that is both one-to-one (injective) and onto (surjective)
is called a bijective function or a one-to-one correspondence.
• Let f be the function from {a, b, c, d} to {1, 2, 3, 4} with f (a) = 4, f (b) =
2, f (c) = 1, and f (d) = 3. Is f a bijection?
• Solution: The function f is one-to-one and onto. It is one-to-one
because no two values in the domain are assigned the same function
value. It is onto because all four elements of the codomain are images
of elements in the domain. Hence, f is a bijection.
IDENTITY FUNCTION ON A SET:
• Given a set X, define a function ix from X to X by ix(x) = x from all x ∈X.
• The function ix is called the identity function on X because it sends
each element of X to itself.
• EXAMPLE:
• Let X = {1,2,3,4}. The identity function ix on X is represented by the
arrow diagram
Inverse Functions and Compositions of
Functions
•  Let f be a one-to-one
correspondence from the set A to
the set B. The inverse function of f is
the function that assigns to an
element b belonging to B the unique
element a in A such that f (a) = b.
The inverse function of f is denoted
by . Hence, (b) = a when
f (a) = b.
EXAMPLE
•  Let f be the function from {a, b, c} to {1, 2, 3} such that f (a) = 2, f (b) = 3,
and f (c) = 1.Is f invertible, and if it is, what is its inverse?
• Solution: The function f is invertible because it is a one-to-one
correspondence. The inverse function reverses the correspondence given
by f , so (1) = c, (2) = a, and (3) = b.
composition of the functions
• Let g be a function from the set A to the set B and let f be a function
from the set B to the set C. The composition of the functions f and g,
denoted for all a ∈ A by f ◦ g, is defined by (f ◦ g)(a) = f (g(a)).
• Let f: X →Y′ and g: Y →Z be functions with the property that the range of f is a
subset of the domain of g i.e. f(X)⊆Y. Define a new function gof:X →Z as
follows: (gof)(x) = g(f(x)) for all x∈X
• The function gof is called the composition of f and g.
Example
• Let g be the function from the set {a, b, c} to itself such that g(a) = b,
g(b) = c, and g(c) = a. Let f be the function from the set {a, b, c} to the
set {1, 2, 3} such that f (a) = 3, f (b) = 2, and f (c) = 1. What is the
composition of f and g, and what is the composition of g and f ?
• Solution: The composition f ◦ g is defined by (f ◦ g)(a) = f (g(a)) = f (b) =
2, (f ◦ g) (b) = f (g(b)) = f (c) = 1, and (f ◦ g)(c) = f (g(c)) = f (a) = 3.
• Note that g ◦ f is not defined, because the range of f is not a subset of
the domain of g
Example
• Let f and g be the functions from the set of integers to the set of integers
defined by f (x) = 2x + 3 and g(x) = 3x + 2. What is the composition of f and g?
What is the composition of g and f ?
• Solution: Both the compositions f ◦ g and g ◦ f are defined. Moreover,
• (f ◦ g)(x) = f (g(x)) = f (3x + 2) = 2(3x + 2) + 3 = 6x + 7
and
• (g ◦ f )(x) = g(f (x)) = g(2x + 3) = 3(2x + 3) + 2 = 6x + 11.
When the composition of a function and its inverse is formed, in either order, an
identity function is obtained

•  To see this, suppose that f is a one-to-one correspondence from the set A to the
set B. Then the inverse function exists and is a one-to-one correspondence from
B to A. The inverse function reverses the correspondence of the original
function, so (b) = a when f (a) = b, and f (a) = b when (b) = a. Hence, ( ◦ f )(a) = (f
(a)) = (b) = a, and (f ◦ )(b) = f ((b)) = f (a) = b.
• Consequently ◦ f = ιA and f ◦ = ιB, where ιA and ιB are the identity functions on
the sets A and B, respectively. That is, ( = f .
Important Functions
• Two important functions in discrete mathematics, namely, the floor
and ceiling functions.
• Let x be a real number. The floor function rounds x down to the
closest integer less than or equal to x, and the ceiling function rounds
x up to the closest integer greater than or equal to x.
• The floor function assigns to the real number x the largest integer that
is less than or equal to x. The value of the floor function at x is
denoted by ˪ x ˩.
• The ceiling function assigns to the real number x the smallest integer
that is greater than or equal to x. The value of the ceiling function at x
is denoted by ɼ x˥.
• 31. a) f (S) = {0, 1, 3} b) f (S) = {0, 1, 3, 5, 8}
• c) f (S) = {0, 8, 16, 40} d) f (S) = {1, 12, 33, 65}

• 33. Suppose that g is a function from A to B and f is a


• function from B to C.
• a) Show that if both f and g are one-to-one functions,
• then f ◦ g is also one-to-one.
• b) Show that if both f and g are onto functions, then
• f ◦ g is also onto
Assignment

• ALL ODD NUMBER of 2.3 till Q no 23

You might also like