CHAPTER 1
SPEAKING MATHEMATICALLY
Copyright © Cengage Learning. All rights reserved.
1.3 The Language of Relations and
Functions
Copyright © Cengage Learning. All rights reserved.
The Language of Relations and Functions
3
Example 1.3.1 – A Relation as a Subset
Let A = {1, 2} and B = {1, 2, 3} and define a relation R from
A to B as follows: Given any (x, y) ∈ A × B,
a. State explicitly which ordered pairs are in A × B and
which are in R.
b. Is 1 R 3? Is 2 R 3? Is 2 R 2?
c. What are the domain and co-domain of R?
4
Example 1.3.1 – Solution (1/2)
a. A × B = {(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3)}. To
determine explicitly the composition of R, examine each
ordered pair in A × B to see whether its elements satisfy
the defining condition for R.
(1, 1) ∈ R which is an integer.
because
(1, 2) ∉ R because which is not an integer.
(1, 3) ∈ R which is an integer.
because
(2, 1) ∉ R because which is not an integer.
5
Example 1.3.1 – Solution (2/2) continued
(2, 2) ∈ R which is an integer.
because
(2, 3) ∉ R because which is not an integer.
Thus
R = {(1, 1), (1, 3), (2, 2)}
b. Yes, 1 R 3 because (1, 3) ∈ R.
No, 2 3 because (2, 3) ∉ R.
Yes, 2 R 2 because (2, 2) ∈ R.
c. The domain of R is {1, 2} and the co-domain is {1, 2, 3}.
6
Example 1.3.2 – The Circle Relation
Define a relation C from R to R as follows: For any
(x, y) ∈ R × R,
(x, y) ∈ C means that
a. Is (1, 0) ∈ C? Is (0, 0) ∈ C? Is ∈ C? Is −2 C 0?
Is 0 C (−1)? Is 1 C 1?
b. What are the domain and co-domain of C?
c. Draw a graph for C by plotting the points of C in the
Cartesian plane.
7
Example 1.3.2 – Solution (1/2)
a. Yes, (1, 0) ∈ C because
No, (0, 0) ∉ C because
Yes, 0 C (−1) because
8
Example 1.3.2 – Solution (2/2) continued
b. The domain and co-domain of C are both R, the set of all
real numbers.
9
Arrow Diagram of a Relation
10
Arrow Diagram of a Relation
Suppose R is a relation from a set A to a set B. The arrow
diagram for R is obtained as follows:
1. Represent the elements of A as points in one region and
the elements of B as points in another region.
2. For each x in A and y in B, draw an arrow from x to y if,
and only if, x is related to y by R. Symbolically:
Draw an arrow from x to y
if, and only if, xRy
if, and only if, (x, y) ∈ R.
11
Example 1.3.3 – Arrow Diagrams of Relations
Let A = {1, 2, 3} and B = {1, 3, 5} and define relations S and
T from A to B as follows:
For every (x, y) ∈ A × B,
(x, y) ∈ S means that x<y S is a “less than” relation.
T = {(2, 1), (2, 5)}.
Draw arrow diagrams for S and T.
12
Example 1.3.3 – Solution
These example relations illustrate that it is possible to have
several arrows coming out of the same element of A
pointing in different directions. Also, it is quite possible to
have an element of A that does not have an arrow coming
out of it.
13
Functions
14
Functions (1/2)
15
Functions (2/2)
Properties (1) and (2) can be stated less formally as
follows: A relation F from A to B is a function if, and only if:
1. Every element of A is the first element of an ordered pair
of F.
2. No two distinct ordered pairs in F have the same first
element.
16
Example 1.3.4 – Functions and Relations on Finite Sets
Let A = {2, 4, 6} and B = {1, 3, 5}. Which of the relations R,
S, and T defined below are functions from A to B?
a. R = {(2, 5), (4, 1), (4, 3), (6, 5)}
b. For every (x, y) ∈ A × B, (x, y) ∈ S means that y = x +
1.
c. T is defined by the arrow diagram
17
Example 1.3.4 – Solution (1/3)
a. R is not a function because it does not satisfy property
(2). The ordered pairs (4, 1) and (4, 3) have the same
first element but different second elements. You can see
this graphically if you draw the arrow diagram for R.
There are two arrows coming out of 4: One points to 1
and the other points to 3.
18
Example 1.3.4 – Solution (2/3)
b. S is not a function because it does not satisfy property
(1). It is not true that every element of A is the first
element of an ordered pair in S. For example, 6 ∈ A but
there is no y in B such that y = 6 + 1 = 7. You can also
see this graphically by drawing the arrow diagram for S.
19
Example 1.3.4 – Solution (3/3)
c. T is a function: Each element in {2, 4, 6} is related to
some element in {1, 3, 5}, and no element in {2, 4, 6} is
related to more than one element in {1, 3, 5}. When
these properties are stated in terms of the arrow
diagram, they become (1) there is an arrow coming out
of each element of the domain, and (2) no element of the
domain has more than one arrow coming out of it.
So you can write T(2) = 5, T(4) = 1, and T(6) = 1.
20
Example 1.3.5 – Functions and Relations on Sets of Strings
Let A = {a, b} and let S be the set of all strings over A.
a. Define a relation L from S to as follows: For
every string s in S and for every nonnegative integer n,
(s, n) ∈ L means that the length of s is n.
Observe that L is a function because every string in S
has one and only one length. Find L(ab a a b a) and
L(b b b).
21
Example 1.3.5 – Functions and Relations on Sets of Strings (1/2)
b. Define a relation C from S to S as follows: For all strings
s and t in S,
(s, t) ∈ C means that t = a s,
where as is the string obtained by appending a on the
left of the characters in s. (C is called concatenation by
a on the left.)
22
Example 1.3.5 – Functions and Relations on Sets of Strings (2/2)
Observe that C is a function because every string in S
consists entirely of a’s and b’s and adding an additional a
on the left creates a new string that also consists of a’s
and b’s and thus is also in S. Find C(ab a a b a) and C(b b
b).
23
Example 1.3.5 – Solution
a. L(a b a a b a) = 6 and L(b b b) = 3
b. C(a b a a b a) = a a b a a b a and C(b b b) = a b b b
24
Function Machines
25
Function Machines (1/3)
Another useful way to think of a function is as a machine.
Suppose f is a function from X to Y and an input x of X is
given. Imagine f to be a machine that processes x in a
certain way to produce the output f(x). This is illustrated in
Figure 1.3.1.
Figure 1.3.1
26
Example 1.3.6 – Functions Defined by Formulas (1/4)
The squaring function f from R to R is defined by the
formula for every real number x. This means that
no matter what real number input is substituted for x, the
output of f will be the square of that number. This idea can
be represented by writing
In other words, f sends each real number x to
27
Example 1.3.6 – Functions Defined by Formulas (2/4)
The successor function g from Z to Z is defined by the
formula g(n) = n + 1.
Thus, no matter what integer is substituted for n, the output
of g will be that number plus 1:
In other words, g sends each integer n to n + 1, or,
symbolically, g: n → n + 1.
28
Example 1.3.6 – Functions Defined by Formulas (3/4)
An example of a constant function is the function h from
Q to Z defined by the formula h(r) = 2 for all rational
numbers r. This function sends each rational number r to 2.
In other words, no matter what the input, the output is
always 2:
29
Example 1.3.6 – Functions Defined by Formulas (4/4)
The functions f, g, and h are represented by the function
machines in Figure 1.3.2.
Figure 1.3.2
30
Function Machines (2/3)
A function is an entity in its own right. It can be thought of
as a certain relationship between sets or as an input/output
machine that operates according to a certain rule.
This is the reason why a function is generally denoted by a
single symbol or string of symbols, such as f, G, of log, or
sin.
31
Function Machines (3/3)
A relation is a subset of a Cartesian product and a function
is a special kind of relation. Specifically, if f and g are
functions from a set A to a set B, then
It follows that
32
Example 1.3.7 – Equality of Functions
Define functions f and g from R to R by the following
formulas:
Does f = g?
33
Example 1.3.7 – Solution
Yes. Because the absolute value of any real number equals
the square root of its square, for all x ∈
R. Hence f = g.
34