Relations and Functions
Relations and Functions
12. Let S = I 2, 4, 6I and T = I l , 3, 5I. Use the set- 14. Let R = {al, S = {x, yl, and T = {p, q, r}. Find
roster notation to write each of the following sets, and each of the following sets.
indicate the number of elements that are in each set. a. RX (S X T)
a. S X T b. (RXS)XT
b. TX S c. RX S X T
c. S XS
15. Let S = I 0, I I. List all the strings of length 4 over
d. T X T
S that contain three or more O's.
13. LetA = {l , 2,3} , B= {u} ,andC= {m,n }.Find
16. Let T = {x, y I. List all the strings of length 5 over
each of the following sets.
T that have exactly one y.
a. AX (BX C)
b. (AXB)XC
c.AXBXC
There are many kinds of relationships in the world. For instance, we say that two people
are related by blood if they share a common ancestor and that they are related by marriage
if one shares a common ancestor with the spouse of the other. We also speak of the rela-
tionship between student and teacher, between people who work for the same employer,
and between people who share a common ethnic background.
Similarly, the objects of mathematics may be related in various ways. A set A may
be said to be related to a set B if A is a subset of B, or if A is not a subset of B, or if A
and B have at least one element in common. A number x may be said to be related to a
number y if x < y, or if x is a factor of y, or if x 2 + y' = I. Two identifiers in a computer
program may be said to be related if they have the same first eight characters, or if the
same memory location is used to store their values when the program is executed . And
the list could go on!
Let A = {O, I, 2} and B = { I, 2, 3} and let us say that an element x in A is related to an
element y in B if, and only if, x is less than y. Let us use the notation x Ry as a shorthand
for the sentence "x is related toy." Then
ORI since 0< I,
OR2 since 0<2,
OR3 since 0 < 3,
lR2 since I < 2,
lR3 since I < 3, and
2R3 since 2 < 3.
Copyright 2020 Cengage Learning. All Right s Reserved. May not be copied, scanned. or dupllcated . In whole or In part. WCN 02-200-203
16 CHAPTER! SPEA KI NG MATHEMATICA LLY
On the other hand, if the notation x/ty represents the sentence "xis not related toy," then
I It I since I </:. I,
2 It I since 2 </:. I, and
2 It 2 since 2 </:. 2.
Recall that the Cartesian product of A and B, A X B, consists of all ordered pairs whose
first element is in A and whose second element is in B:
A x B = I(x, y) Ix EA and y EB).
In this case,
A XB = ((0, I), (0, 2), (0, 3), (I , I), (I, 2), (I, 3), (2, I), (2, 2), (2, 3)}.
The elements of some ordered pairs in A X Rare related, whereas the elements of other
ordered pairs are not. Consider the set of all ordered pairs in A X B whose elements are
related
{(0, I), (0, 2), (0, 3), (I , 2), (I, 3), (2, 3)).
Observe that knowing which ordered pairs lie in this set is equivalent to knowing which
elements are related to which. The relation itself can therefore be thought of as the totality of
ordered pairs whose elements are related by the given condition. The formal mathematical
definition of relation, based on this idea, was introduced by the American mathematician
and logician C. S. Peirce in the nineteenth century.
Definition
Let A andB be sets. A relationR from A toB is a subset of A X B. Given an ordered
pair (x, y) in A X B, xis related toy by R, written x Ry, if, and only if, (x, y) is in R.
The set A is called the domain of R and the set B is called its co-domain.
The notation for a relation R may be written symbolically as follows:
x Ry means that (x,y) ER.
Copyright 2020 Cengage Leam ing . All Rights Reserve d. May not be copied, scanned, or duplicated. In whole or In part. WCN D2· 200 -203
1.3 THE LA NGUAG E OF RE LAT IONS AND FUNC TIONS 17
Solution
a. Yes, (I , 0) EC because 12 +02 = I.
No, (0, 0) rte C because 02 + 0 2 = 0 * I.
Yes,(-½, 4)EC because(-½)' +(~) 2
= ¼+ ¾= I.
No, -2,e:'Obecause(-2) 2 +0 2 =4* I.
Yes, 0 C (-1) because 0 2 + (-1) 2 = I.
No, I .e:' I because 1 + 1 = 2 I.
2 2
*
b. The domain and co-domain of Care both R, the set of all real numbers.
C.
-I
Copyright 2020 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated. In whole or In part. WCN 02-200-203
18 CHAPTERl SPEAKING MATHEMATICALLY
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.
Functions
In Section 1.2 we showed that ordered pairs can be defined in terms of sets and we defined
Cartesian products in terms of ordered pairs. In this section we introduced relations as subsets
of Cartesian products. Thus we can now define functions in a way that depends only on the
concept of set. Although this definition is not obviously related to the way we usually work
with functions in mathematics, it is satisfying from a theoretical point of view, and computer
scientists like it because it is particularly well suited for operating with functions on a computer.
Definition
Copyright 2020 Cengage Learning. All Rights Reserved. May not be copied, scanned. or duplicated, In whol e or In par1. WCN 02-200 -203
1.3 THE LANG UAGE OF RELATIONS AND FUNCT IONS 19
Properties (I) and (2) can be stated less formally as follows: A relation F from A to Bis
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.
In most mathematical situations we think of a function as sending elements from one
set, the domain, to elements of another set, the co-domain. Because of the definition of
function, each element in the domain corresponds to one and only one element of the
co-domain.
More precisely, if Fis a function from a set A to a set B, then given any element x in A,
property (I) from the function definition guarantees that there is at least one element of B
that is related to x by F and property (2) guarantees that there is at most one such element.
This makes it possible to give the element that corresponds to x a special name.
If A and B are sets and Fi s a function from A to B, then given any element x in A, the
unique element in B that is related to x by Fis denoted F(x), which is read "F of x ."
A B
Solution
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 I and the other points to 3.
b. Sis not a function because it does not satisfy property (I). It is not true that every
element of A is the first element of an ordered pair in S. For example, 6 EA but there
is no yin B such that y = 6 + 1 = 7. You can also see this graphically by drawing the
arrow diagram for S.
Copyright 2020 Cengage Learning. All Rights Re served. May not be copied, scanned, or dupllc11ted, In whole or In part. WCN 02·200-203
20 CHAPTER ! SPEAK ING MATHEMAT ICALLY
Solution
a. L(abaaba) = 6 and L(hhh) = 3
b. C(ahaaha) = aahaaha and C(bhb) = ahhb
Function Machines
Anotheruseful way to think of a function is as a machine. Supposefis a function from X to
Yand an input x of Xis given. Imaginefto be a machine that processes x in a certain way
to produce the outputf(x). This is illustrated in Figure 1.3.1.
Input
function machine
f(x) Output
FIGURE 1.3.1
Copyright 2020 Cengage Learning. All Rights Reserved. May not be copied, scanned. or dupllcated. In whole or In part. WCN 02-200-203
1.3 THE LANGUAG E OF RELATI ONS AND FUNC TI ONS 21
\
g(n)=n+I
\
ll(r) =2
(a) (b) (c)
FIGURE 1.3.2
It follows that
/ equals g, written/= g, if, and only if, /(x) = g(x) for all x in A.
Copyright 2020 Cengage Learning. All Rights Reserved. May not be copied, scanne d. or duplicated, in whole or In part. WCN 02-200-203
22 CHAPTER ! SPEAK ING MATHEM ATIC ALLY
TEST YOURSELF _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __
1. Given sets A and B, a relation from A to B is _ _ _ b. for all elements x in A and y and z in B, if
_ __ then _ _ _ _
2. A function F from A to B is a relation from A to B
that satisfies the following two properties: 3. If Fis a function from A to Band xis an element
a. for every element x of A, there is _ _ _ _ of A, then F(x) i s - - - ·
EXERCISE SETl.3 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __
1. Let A= {2, 3,4} andB= {6,8, IO} and define c. Write the domain and co-domain of V.
a relation R from A to B as follows: For every d. Draw an arrow diagram for V.
(x,y) EA X B,
5. Define a relation S from R to R as follows:
(x, y) E R means that l is an integer. For every (x, y) E R X R,
X
(x, y) E S means that x ;;,: y .
a. Is 4 R 6? Is 4 R 8? Is (3, 8) E R? Is (2, 10) E R?
b. Write Ras a set of ordered pairs. a. Is (2, I) E S? Is (2, 2) E S? Is 2 S 3?
c. Write the domain and co-domain of R. Is (-1) S (-2)?
d. Draw an arrow diagram for R. b. Draw the graph of Sin the Cartesian plane.
2. Let C = D = {-3, -2, - ! , !, 2, 3) and define 6. Define a relation R from R to R as follows:
a relation S from C to D as follows: For every
For every (x, y) E R X R,
(x,y)E ex D,
(x, y) E R means that y= x2.
(x, y) E S means that }- tis an integer.
a. Is (2, 4) ER? Is (4, 2) ER? Is (-3) R 9?
a. Is 2 S 2? Is - I S - I? Is (3, 3) E S? Is 9 R (-3)?
Is (3, -3) ES? b. Draw the graph of R in the Cartesian plane.
b_ Write Sas a set of ordered pairs. 7. Let A= {4, 5, 6} and B = {5, 6, 7} and define
c. Write the domain and co-domain of S. relations R, S, and T from A to Bas follows:
d. Draw an arrow diagram for S. For every (x, y) EA X B:
3. Let E = I I, 2, 3 I and F = I -2, - I, 0 I and define (x, y) E R means that x;;,: y.
a relation T from E to Fas follows: For every x-y
(x, y) E S means that is an integer.
(x,y) E £ X F,
T = {(4, 7), (6, 5), (6, 7)}.
(x, y) E T means that x; Y is an integer.
a. Draw arrow diagrams for R, S, and T.
a. Is 3 TO? Is I T(-1)? Is (2, -1) ET? b. Indicate whether any of the relations R, S, and
Is (3, -2) E T? Tare functions.
b. Write T as a set of ordered pairs.
8. Let A = {2, 4} and B = I I, 3, 5} and define rela-
c. Write the domain and co-domain of T.
tions U, V. and W from A to B as follows:
d. Draw an arrow diagram for T.
For every (x, y) EA X B:
4. Let G = {-2, 0, 2) and H = {4, 6, 8} and define a
relation V from G to Has follows: For every (x, y) E U means that y- x > 2.
(x,y)E G X H, (x, y) E V means that y- 1= f
(x, y) E V means that x Y is an integer. W = {(2, 5), (4, !), (2, 3)}.
a. Draw arrow diagrams for U, V, and W.
a. Is 2 V 6? Is (-2) V (8)? Is (0, 6) E V?
b. Indicate whether any of the relations U, V, and
Is (2, 4) EV?
W are functions.
b. Write Vas a set of ordered pairs.
Copyright 2020 Cengage Learning. AU Rights Reserved. May not be copied, scanned. or dupllcated. In whole or In part. WCN 02-200-203
1.3 THE LANGUAGE OF RE LATIONS AND FUNCTIONS 23
A B
zxl+2x
J(x) = 2x and g(x) = 7'+"I·
Doesf= g? Explain.
a. Write the domain and co-domain of G.
b. Find G(I), G(2), G(3), and G(4). 20. Define functions Hand K from R to R by the fol-
lowing formulas: For every x E R,
15. Let X = { 2, 4, 5} and Y = { I, 2, 4 , 6}. Which of
H(x) = (x-2) 2 and K(x) = (x- l)(x-3)+ I.
the following arrow diagrams determine functions
from Xto Y? Does H = K? Explain.
Copyright 2020 Cengage Learning. All Rights Reserved. May not be copied, scanned, or dupllcated. In whole or In part. WCN 02-200-203