2. Relations and Functions
A relation between two sets A and B is a collection of ordered pairs, where the
first coordinate comes from A (domain) and the second comes from B (range).
E.g. if A = {1, 2, 3, 4} and B = {a, b, c}, one relation is the three pairs {(1, c), (1,a),
(3, a)}.
A function on sets A and B is a special kind of relation where every element of A
(domain) is paired with exactly one element from B (range).
e.g. {(1, a), (2, a), (3, b), (4, b)} is a function from A to B.
The relation above fails to be a function in two ways.
• Not every element of A is paired with an element from B
• The element 1 is used twice, not once.
Note there is no such restrictions on B; that is, elements from B can be paired
with elements from A many times or not at all.
1
2
3
4
a
b
c
A B
1
2
3
4
a
b
c
A B
4. Examples
Consider the following three relations on the set A = {1, 2, 3}:
• f = {(1, 3), (2, 3), (3, 1)},
• g= {(1, 2), (3, 1)},
• h= {(1, 3), (2, 1), (1, 2), (3, 1)}
f is a function from A into A since each member of A appears
as the first coordinate in exactly one ordered pair in f; here
f (1) = 3, f (2) = 3, and f (3) = 1.
g is not a function from A into A since 2 ∈ A is not the
first coordinate of any pair in g and so g does not assign any
image to 2.
h is not a function from A into A since 1 ∈ A appears as the
first coordinate of two distinct ordered pairs in h, (1, 3) and
(1, 2). If h is to be a function it cannot assign both 3 and 2
to the element 1 ∈ A.
5. Relations and Functions
Try
• Let X = {1, 2, 3, 4}. Determine whether each
relation on X is a function from X into X.
(a) f = {(2, 3), (1, 4), (2, 1), (3.2), (4, 4)}
(b) g = {(3, 1), (4, 2), (1, 1)}
(c) h = {(2, 1), (3, 4), (1, 4), (2, 1), (4, 4)}
6. Relations and Functions
DEFINITION
• A function ƒ from a set A to a set B is a rule that assigns a unique
(single) element ƒ(x) ∈ B to each element x ∈ A.
• The set A of all possible input values is called the domain of the function.
• The set B is called the target set or co-domain.
• The set of all values of ƒ(x) as x varies through out A is called the range of the
function.
• The range may not include every element in the set B (co-domain).
1
2
3
4
a
b
c
A (domain) B (Co-domain)
Range
7. Functions and Algorithms
let f denote a function from A into B. Then we
write f: A → B
• If 2 ∈ 𝐴, then 𝑓 (2) (read: “f of 2”) denotes
the unique element of B which f assigns to a; it
is called the image of 2 under f, or the value of f
at 2. in this case a
1
2
3
4
a
b
c
A B
f: A → B
8. Functions Defined by Equations
• Consider the equation y=x2 - 3x, where x can be any
real number. This equation assigns to each x-value
exactly one corresponding y- value.
• Example
9. Functions Defined by Equations
• Note that y depends on what value of x is
selected,
• y is the dependent variable (Range) .
• x is the independent variable (Domain)
• it is important to recognize that not all
equations define functions.
10. Functions Defined by Equations
• An equation is a function if each element in
the domain corresponds to exactly one
element in the range.
• Example
Not FunctionsFunctions
11. Vertical Line Test
• Given the graph of an equation, if any vertical
line that can be drawn intersects the graph at
no more than one point, the equation defines
a function of x.
• This test is called the vertical line test.
14. Expressing a Function
• A function can be expressed one of four ways:
– verbally,
– numerically
– algebraically
– graphically
This is sometimes called the Rule of 4.
15. Function Notation
• Equation y = 2x + 5 is a function
• If we give the function a name, say, “ƒ ”, then we can
use function notation:
f (x) = 2x + 5
The symbol f (x) is read “f evaluated at x” or “f of x” and
represents the y-value that corresponds to a particular
x-value. In other words, y = f (x) a function can be
expressed by means of a mathematical formula.
The function 𝑓 𝑥 = 2𝑥 + 5 can be writen as 𝑥 →
2𝑥 + 5 or 𝑦 = 2𝑥 + 5
16. Function Notation
It is important to note that f is the function name,
whereas f (x) is the value of the function
18. Evaluating Functions by Substitution
Find 𝑓 (−2), 𝑓 (0), and 𝑓 (6) for 𝑓 (𝑥) = 𝑥 + 3.
We need to substitute −2, 0, and 6 for x in the function.
𝑓 (−2) = −2 + 3 = √1 = 1
𝑓 (0) = 0 + 3 = √3
𝑓 (6) = 6 + 3 = √9 = 3
Find 𝑓 (−8), 𝑓 (𝜋), and 𝑓 (10) for 𝑓 (𝑥) = 16.
𝑓 (𝑥) = 16 is a constant function, so the y-value is 16 no matter what quantity
is in the parentheses.
𝑓 (−8) = 16 𝑓 (𝜋) = 16 𝑓 (10) = 16
19. Evaluating Functions by Substitution
A piecewise function is a function with two or more formulas for computing 𝑦.
The formula to use depends on where 𝑥 is. There will be an interval for
𝑥 written next to each formula for 𝑦.
𝑓 𝑥 =
𝑥 − 1 𝑖𝑓 𝑥 ≤ −2
2𝑥 𝑖𝑓 − 2 < 𝑥 < 2
𝑥2
𝑖𝑓 𝑥 ≥ 2
In this example, there are three formulas for 𝑦: 𝑦 = 𝑥 − 1, 𝑦 = 2𝑥, and
𝑦 = 𝑥2, and three intervals for 𝑥: 𝑥 ≤ −2, −2 < 𝑥 < 2, and 𝑥 ≥ 2.
When evaluating this function, we need to decide to which interval 𝑥 belongs.
Then we will use the corresponding formula for 𝑦.
20. Evaluating Functions by Substitution
To find f (5), f (−3), and 𝑓 (0) for the function above.
For 𝑓 (5), does 𝑥 = 5 belong to 𝑥 ≤ −2, −2 < 𝑥 < 2, or 𝑥 ≥ 2?
Because 5 ≥ 2, we will use 𝑦 = 𝑥2, the formula written next to 𝑥 ≥ 2.
𝑓 (5) = 52 = 25
For 𝑓 (−3), does 𝑥 = −3 belong to 𝑥 ≤ −2, −2 < 𝑥 < 2, 𝑜𝑟 𝑥 ≥ 2?
Because −3 ≤ −2, we will use 𝑦 = 𝑥 − 1, the formula written next to
𝑥 ≤ −2.
𝑓 (−3) = −3 − 1 = −4
For 𝑓 (0), does 𝑥 = 0 belong to 𝑥 ≤ −2, −2 < 𝑥 < 2, 𝑜𝑟 𝑥 ≥ 2?
Because
−2 < 0 < 2, we will use 𝑦 = 2𝑥, the formula written next to −2 <
𝑥 < 2.
𝑓 (0) = 2(0) = 0
26. Domain of a Function
• “What can x be?” The domain of a function excludes
values that cause a function to be undefined or have
outputs that are not real numbers.
37. ONE-TO-ONE, ONTO, AND INVERTIBLE
FUNCTIONS
A function f : A → B is said to be one-to-one (written 1-1) if different
elements in the domain A have
distinct images. That is f is one-to-one if f (a) = f (a’) implies a = a’
A function f: A → B is said to be an onto function if each element of B
is the image of some element of A.
Thus: f : A → B is onto if the image of f is the entire codomain, i.e.,
if f (A) = B. In such a case we say that f is a function from A onto B or
that f maps A onto B.
A function f: A → B is invertible if its inverse relation f −1 is a function
from B to A. In general, the inverse
relation f −1 may not be a function.
Theorem : A function f: A → B is invertible if and only if f is both one-
to-one and onto.
38. EXAMPLE
Consider the functions f1: A → B, f2: B → C, f3: C → D
and f4: D → E defined by the diagram of below.
Which of the function(s) are
a) One-to-one
b) Onto
c) Invertible
39. Geometrical Characterization of One-
to-One and Onto Functions
(1) f :R → R is one-to-one if each horizontal line
intersects the graph of f in at most one point.
(2) f :R → R is an onto function if each horizontal line
intersects the graph of f at one or more points.
Which of the following function is one to one or onto?