0% found this document useful (0 votes)
6 views

Functions

The document provides an overview of functions in discrete mathematics, including definitions of injections, surjections, and bijections. It explains the concepts of domain, codomain, range, image, and preimage, along with examples to illustrate whether certain relations are functions. Additionally, it covers inverse functions and function composition, providing exercises for practice.

Uploaded by

Hacchi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Functions

The document provides an overview of functions in discrete mathematics, including definitions of injections, surjections, and bijections. It explains the concepts of domain, codomain, range, image, and preimage, along with examples to illustrate whether certain relations are functions. Additionally, it covers inverse functions and function composition, providing exercises for practice.

Uploaded by

Hacchi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

Discrete

Mathematics
Functions
Outline

Injection,
Definition of
Surjection,
a Function
Bijection

Inverse Function
Function Composition
Functions
 A special type of a relation
 Sometimes called mappings or
transformations
 A function represented as
f : A → B such that
✓ the domain of f is A for all a ∈ A
Dom(f),
✓ f(a) contains just one element of B
Functions
A good example that you can “relate” to is
students in our Math class this semester are set
A. The grade they earn out of the class is set B.
Each student must be assigned a grade and can
only be assigned ONE grade, but more than one
student can
Students Grades

1.00
Marian Rivera
1.50
Kim Chui 1.75

Xian Lim 3.00

5.00
Sarah Geronimo
Functions

Example :
Given A = {1,2,3,4,5} B = { 2,4,6,8,10} and
f = {(1,4) (4,8), (2,2), (5,6),(3,10)}. Identify if f is a
function.

f(1) = 4 f(5) = 6
f(4) = 8 f(3) = 10
f(2) = 2

Dom(f) = {1,4,2,5,3} = A
f(n) contains just one element of B
therefore : f is function
A function f from set A to set B is a rule of
correspondence that assigns to each element x in the
set A exactly
exactly one
one element
element yy in
in the
the set
set B.
B.

1 2
2 4
3 6
4 8
5 10

Set A is the domain Set B is the codomain

Conditions
Whew!are met…
What
This
did isthat
a function
say? Must use all the x’s
The x value can only be assigned to one y
Let’s look at another relation and decide if it is a
function.
The second condition says each x can have only one y, but it
CAN be the same y as another x gets assigned to.

1
2
2
4
3
6
4 8
5 10

Set A is the Set B is the


domain codomain

Conditions are met …


This is a function Must use all the x’s

The x value can only be assigned to one y


Another Example :

1
2
2
4
3
6
4 8
5 10

2 was assigned both 4 and 10

Is the relation shown above a function? NO


Why not???
Check this relation out to determine if it is a function.
It is not--- 3 didn’t get assigned to anything… Comparing
to our example, a student in math must receive a grade

1
2
2
4
3
6
4 8
5 10

Set A is the domain Set B is the codomain

It doesn’t assign each x with a y


This is not a function
Must use all the x’s
The x value can only be assigned to one y
Check this relation out to determine if it is a function.
This is fine—each student gets only one grade. More
than one can get 1.25 and don’t have to give any 5.0
(so all y’s don’t need to be used).

1
2
2
4
3
6
4 8
5 10

Set A is the domain Set B is the codomain

This is a function
Must use all the x’s

The x value can only be assigned to one y


Domain, Codomain, Range,
Image, Preimage
Given a function f: A → B:
 We say f maps A to B or
f is a mapping from A to B.
 A is called the domain of f, Dom (f)
 B is called the codomain of f ,
Codom(f)
 If f(a) = b,
 then b is called the image of a
under f. It is also known as the
range of the function f.
 a is called the preimage of b.
Domain, Codomain, Range,
Image, Preimage
Given a function f: A → B:
 The range of f is the set of all
images of points in A under f. We
denote it by f(A).
 It follows that the range is a subset
of the codomain.
 Two functions are equal when they
have the same domain, the same
codomain and map each element of
the domain to the same element of
the codomain.
Questions
f(a) = ? z

The image of d is ? z A B
a
The domain of f is ? A x

b
The codomain of f is ? B y
c
The preimage of y is ? b
d z

f(A) = ? B

The preimage(s) of z is (are) ? {a,c,d}


Question on Functions and Sets

 If f: A → B and S is a subset of A,
then
f(S) = { f(s) | s  S}
A B
a
f {a,b,c,} is ? {y,z} x

b
f {c,d} is ? {z} y
c

d z
Representing Functions

 Functions may be specified in different ways:


 An explicit statement of the assignment.
Students and grades example.
 A formula.
f(x) = x + 1
 A computer program.
A Java program that when given an integer
n, produces the nth Fibonacci Number
Exercise
Let A={a,b,c,d} and B={1,2,3}. Determine whether the
relation from A to B is a function. If it is a function, give its
range.
1. R = {(a,1), (b,2), (c,1), (d,2)}
2. R = { (a,1), (b,2), (a,2), (c,1), (d,2)}
3. R = {(a,3),(b,2), (c,1) }
4. R = {(a,1), (b,1), (c,1), (d,1)}
Exercise

List all functions F:{a,b,c}→{0,1}.

Answer:
F1 = {(a,0),(b,0),(c,0)} F5 = {(a,1),(b,0),(c,0)}
F2 = {(a,0),(b,0),(c,1)} F6 = {(a,1),(b,0),(c,1)}
F3 = {(a,0),(b,1),(c,0)} F7 = {(a,1),(b,1),(c,0)}
F4 = {(a,0),(b,1),(c,1)} F8 = {(a,1),(b,1),(c,1)}
Special Types of
Function
Special Type of Functions:
Injections
Definition: A function f is said to be one-to-one , or
injective, if and only if f(a) = f(b) implies that a = b
for all a and b in the domain of f. A function is said to
be an injection if it is one-to-one.
Injective means we won't have two or more "A"s
pointing to the same "B".

A B
a x
v
b
y
c
z
d

w
Surjections
Definition: A function f from A to B is called onto or
surjective, if and only if for every element a  A
there is an element b  B with f(a) = b . A function
f is called a surjection if it is onto.
There won't be a "B" left out.

A B
a x

b
y
c
z
d
Surjections
Definition: A function f from A to B is called onto or
surjective, if and only if for every element a  A
there is an element b  B with f(a) = b . A function
f is called a surjection if it is onto.
There won't be a "B" left out.

A B
a x

b
y
c
z
d
Bijections
Definition: A function f is a one-to-
one correspondence, or a bijection,
if it is both one-to-one and onto
(surjective and injective).
Think of it as a "perfect pairing"
between the sets: everyone has a
partner, and no one is left out.

A B
a x

b
y
c

d z

w
Summary

Not a Function Injective


General Function
A has many B (not surjective)
B can have many A
B can’t have many A

Surjective Bijective
(not injective ) (injective, surjective )
Every B has some A A to B, perfectly
Showing that f is one-to-one
or onto
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 or surjective function?

Answer: Yes, f is onto since all three elements of the


codomain are images of elements in the domain. If the
codomain were changed to {1,2,3,4}, f would not be
onto.
Exercise

Determine whether each of these functions from {a, b, c, d} to


itself is one-to-one.
1. f (a) = b, f (b) = a, f (c) = c, f (d) = d
2. f (a) = b, f (b) = b, f (c) = d, f (d) = c
3. f (a) = d, f (b) = b, f (c) = c, f (d) = d
Exercise
Sets A and B, and a function from A to B are given. Determine
whether the function is injective, surjective, or bijective.
1. A={1,2,3,4}=B;
f = {(1, 1), (2, 3), (3, 4), (4, 2)}
2. A = {1, 2, 3} ; B = {a, b, c, d};
f = {(1, a), (2, a), (3, c)}
3. A = {1.1, 7, 0.06}; B = {p, q};
f = {(1.1, p), (7,q), (0.06, p)}
Inverse Functions

Definition: Let f be a bijection from A to B. Then


the inverse of f, denoted f-1 , is the function
from B to A defined as
f-1 (y) = x iff f(x) = y
No inverse exists unless f is a bijection. Why?
Inverse Functions

A f B A B
a V
a V

b b
W W
c c

d X d X

Y Y
Questions
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 so, what is its inverse?

Answer:
The function f is invertible because it is a one-to-one
correspondence. The inverse function f-1 reverses
the correspondence given by f, so
f-1 (1) = c
f-1 (2) = a
f-1 (3) = b.
Exercise
Let f be a function from A = {1, 2, 3, 4} to B = {a, b, c, d}.
Determine whether f-1 is a function.

1. f = {(1,a), (2,a), (3,c), (4,d)}

2. f = {(1,a), (2,c), (3,b), (4,d)}

3. f = {(2,a), (3,c), (4,a), (1,d)}

4. f = {(3,a), (4,b), (2,d), (1,c)}


Composition
 Definition: Let f: B → C, g: A → B. The
composition of f with g, denoted f ○ g is the
function from A to C defined by
f ○ g(x) = f(g(x))
Composition

g f
A B C
a V
h
b i
W
c
d X j A C
Y a
h
b
i
c

d j
Composition
Example 1:
If f(x) = x2 and g(x) = 2x + 1, then
f(g(x)) = (2x + 1)2 and g(f(x)) = 2x2 + 1

f ○ g (x) = f(g(x))
= f(2x + 1)
= (2x + 1)2

g ○ f (x) = g(f(x))
= g(x2)
= 2x2 + 1
Composition Questions
Example 2:
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 1: 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.
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.
Composition Questions
Example 2:
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 2: The composition f ∘ g is defined by


g = {(a,b), (b,c), (c,a)}
f = {(a,3), (b,2), (c,1) }
f o g = { (a,2), (b,1), (c,3) }
Composition Questions
Example 2:
Let f and g be 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, and the composition of
g and f ?

Solution:
f∘ g (x)= f(g(x)) g∘ f (x)= g(f(x))
= f(3x + 2) = g(2x + 3)
= 2(3x + 2) + 3 = 3(2x + 3) + 2
= 6x + 4 + 3 = 6x + 9 + 2
= 6x + 7 = 6x + 11
Composition Questions
Example 2:
Let f and g be 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, and the composition of
g and f ?

Solution:
f∘ g (x)= f(g(x)) g∘ f (x)= g(f(x))
= f(3x + 2) = g(2x + 3)
= 2(3x + 2) + 3 = 3(2x + 3) + 2
= 6x + 4 + 3 = 6x + 9 + 2
= 6x + 7 = 6x + 11
Composition Questions
Additional Exercise:
1. Functions f and g are sets of ordered pairs f = {(-2,1),
(0,3),(4,5)} and g = {(1,1), (3,3), (7,9)} Find the composite
function defined by g ○ f and describe its domain and range.

2. Given f(x) = x + 1 , g(x) = 3x Find the composition function


(f ○ g) (x).

3. Consider f(x) = x2 and g(x) = 3x Find the composition (f ∘ g) (x)


Composition Questions
Exercise:
 Given f(x) = 3x + 2 and g(x) = 2x + 5. Find

a) (f o g)(5)

b) ( f o g)(x)

c) (g ○ f) (2)

d) (f o f ) (x)

 Given f(x) = 2x – 4 and g(x) = 2x + 8. Find

a) (g ∘ f)( x)

b) (g o g) (x)

You might also like