0% found this document useful (0 votes)
3 views28 pages

9. Functions for IT 1R4 Continuation

The document provides an overview of functions in mathematics and computer science, including definitions, examples, and properties such as one-to-one, onto, and bijection. It discusses the concepts of inverse functions and composition of functions with various examples illustrating these principles. Additionally, it includes exercises for creating one-to-one and onto functions, finding inverses, and demonstrating function composition.

Uploaded by

Lovely Alabe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views28 pages

9. Functions for IT 1R4 Continuation

The document provides an overview of functions in mathematics and computer science, including definitions, examples, and properties such as one-to-one, onto, and bijection. It discusses the concepts of inverse functions and composition of functions with various examples illustrating these principles. Additionally, it includes exercises for creating one-to-one and onto functions, finding inverses, and demonstrating function composition.

Uploaded by

Lovely Alabe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

Functions

Introduction
The concept of a function is extremely important in mathematics and
computer science. In discrete mathematics, functions are used in the
definition of such discrete structures as sequences and strings.
Functions are also used to represent how long it takes a computer to
solve problems of a given size. Many computer programs and
subroutines are designed to calculate values of functions.
Introduction
For example, 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 Good friend, A for Rodriguez,
and F for Stevens. This assignment is an example of a function.

Assignment of Grades in a Discrete Mathematics Class


Functions

Note: Functions are sometimes also called mappings or transformations.


Functions

Domain Codomain

The Function f Maps A to B


Functions
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 Good friend, 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 = {Adams, Chou, Goodfriend, Rodriguez, Stevens}
The codomain of G = {A,B,C,D,F}.
The range of G = {A,B,C,F}.
Functions
Let R be the relation with ordered pairs (Abdul, 22), (Brenda, 24), (Carla, 21), (Desire, 22),
(Eddie, 24), and (Felicia, 22). Here each pair consists of a graduate student and student’s
age. Suppose that the age for graduate students is up to 50. Find the domain, codomain,
and range of this relation.

Solution:
If f is a function specified by R, then f(Abdul) =22, f(Brenda) =24, f(Carla) =21, f(Desire) =22,
f(Eddie) =24, and f(Felicia) =22.
(Here, f(x) is the age of x, where x is a student.)

For the domain, we take the set {Abdul, Brenda, Carla, Desire, Eddie, Felicia}.
For the codomain, we take the set of ages until 50.
For the range, we take the set of different ages of these students {21,22,24}.
Functions
Let f : Z → Z assign the square of an integer to this integer. In other words, f(x)= 𝑥 2 .
What is the domain? codomain? range?

Solution:

The domain of f is set the of all integers, or equivalently Z.


The codomain of f is the set of all integers, or equivalently Z.
The range of f is the set of all integers that are perfect squares, namely, {0,1,4,9,...}.
Functions

Let 𝑓1 and 𝑓2 be functions from R to R such that 𝑓1 (x) = 𝑥 2 and 𝑓2 (x) = 𝑥 − 𝑥 2 . What
are the functions 𝑓1 + 𝑓2 and 𝑓1 𝑓2 ?
Solution:
From the definition of the sum and product of functions, it follows that

𝑓1 + 𝑓2 (x) = 𝑓1 (x) + 𝑓2 (x) = 𝑥 2 + (𝑥 − 𝑥 2 ) = 𝒙 and

𝑓1 𝑓2 (x) = 𝑥 2 + (𝑥 − 𝑥 2 ) = 𝒙𝟑 − 𝒙𝟒 .
Functions

Note: f(S) denotes a set, and not the value of the function f for the set S.

Let A ={a,b,c,d,e} and B ={ 1,2,3,4} with f(a) = 2, f(b) = 1, f(c) = 4, f(d) = 1, and f(e) = 1.
What is the image of the subset S ={b,c,d}?

f(S)={ 1,4}.
One-to-one Function

Note: A function f is one-to-one if and only if f(a) ≠ f(b) whenever a ≠ b.

A One-to-One Function
One-to-one Function
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

The function f takes on different values at


the four elements of its domain. Therefore,
f is one-to-one.
One-to-one Function
Determine whether the function f(x)= 𝑥 2 from the set of integers to the set of integers
is one-to-one.

Solution:

The function f(x)= 𝑥 2 is not one-to-one because, for instance, f(1) = f(−1) = 1, but 1 ≠ −1.

Determine whether the function f(x)= x +1 from the set of real numbers to itself is one-to-one.

Solution:

The function f(x)= x +1 is a one-to-one function. To demonstrate this, note that x +1 ≠ y +1


when x ≠ y.
One-to-one Function
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. When will this be a one-to-one
function?

Solution:
If every worker is assigned to different jobs (i.e. no two workers working a same job),
then this can become a one-to-one function.
Onto Function

Note: A function f is onto if ∀y∃x(f(x)= y), where the domain for x is the domain of the function
and the domain for y is the codomain of the function.

An Onto Function
Onto Function

Solution:
Because all three elements of the codomain are images
of elements in the domain, we see that f is onto.

What if the codomain was {1,2,3,4}? Is f still onto?

Solution:
Because not all elements of the codomain are images of elements in the domain,
we see that f is not onto.
Onto Function
Is the function f(x) = 𝑥 2 from the set of integers to the set of integers onto?

Solution:
The function f is not onto because there is no integer x with 𝑥 2 = −1, for instance.

Is the function f(x)= x +1 from the set of integers to the set of integers onto?

Solution:
This function is onto, because for every integer y there is an integer x such that f(x)= y. To see
this, note that f(x)= y if and only if x +1= y, which holds if and only if x = y −1.
Onto Function
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. When will this be an onto
function?

Solution:
If every job is assigned to different workers (i.e. no job is left unworked), then this
can become an onto function.
Bijection

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
Correspondences Types

Different Types of Correspondences


Summary
Inverse Functions

The Function f−1 Is the Inverse of Function f


Inverse Functions
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
𝑓 −1 reverses the correspondence given by f, so 𝑓 −1 (1) = c, 𝑓 −1 (2) = a, and 𝑓 −1 (3) = b.

Let f :Z→Z be such that f(x)= x +1. Is f invertible, and if it is, what is its inverse?

Solution:
The function f has an inverse because it is a one-to-one correspondence. To reverse the
correspondence, suppose that 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 f. Consequently, 𝑓 −1 (y) = y −1.
Inverse Functions
Let f be the function from R to R with f(x)= 𝑥 2 . Is f invertible?
Solution:
Because f(−2) = f(2) =4, f is not one-to-one. If an inverse function were defined, it would
have to assign two elements to 4. Hence, f is not invertible. (Note we can also show that f
is not invertible because it is not onto.)

Note: Sometimes we can restrict the domain or the codomain of a function, or both, to obtain an invertible function

Show that if we restrict the function f(x)= 𝑥 2 in Example 20 to a function from the set of all
nonnegative real numbers to the set of all nonnegative real numbers, then f is invertible.

Because the function f(x)= 𝑥 2 from the set of nonnegative real numbers to the set of
nonnegative real numbers is one-to-one and onto, it is invertible. Its inverse is given by the
rule 𝑓 −1 (y) =√y.
Composition of Functions

The Composition of the Functions f and g


Composition of Functions
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?

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.

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.
Exercise
• Create 2 one-to-one functions
• Create 2 onto functions
• Create 2 functions and find its inverse
• Create 2 examples exemplifying the concept of composition of functions

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy