Logic with Elements of Set Theory
Relations & Functions
November 2014
Recall that given any sets X and Y , the symbol X × Y stands for the Cartesian product of X and Y , ie.:
X × Y := {(x, y) : x ∈ X, y ∈ Y }
and that in general, X × Y 6= Y × X. Any A ⊂ X × Y is called a (binary) relation in X × Y (or simply
in X when X = Y ). When (x, y) ∈ A we say that (x, y) fulfils A and denote it as x A y. If (x, y) ∈
/ B, we
write x B
6 y.
Given a relation A we define its domain and range, respectively, as:
dom A := {x ∈ X : ∃(y ∈ Y ) (x, y) ∈ A},
rng A := {y ∈ Y : ∃(x ∈ X) (x, y) ∈ A}.
For any X 6= ∅ we can enlist at least 3 relations on X, namely:
3. X 2 := {(x, y) : x, y ∈ X}.
2. idX := {(x, x) : x ∈ X},
1. ∅,
Given a relation A in X × Y , by its inverse we understand a relation A−1 defined as
A−1 := {(y, x) ∈ Y × X : (x, y) ∈ A} .
Let A ⊂ X × Y and B ⊂ Y × Z. A composite (or composition) of A and B, denoted by B ◦ A is the
relation in X × Z defined as
B ◦ A := {(x, z) ∈ X × Z : ∃(y ∈ Y ) ((x, y) ∈ A ∧ (y, z) ∈ B)} .
Exercise 0.0 What are dom A−1 , rng A−1 , dom idX , rng idX , dom ∅, rng ∅, dom X 2 and rng X 2 ?
Exercise 0.1 What are A−1 ◦ A and A ◦ A−1 and A−1 ◦ B −1 ?
Exercise 0.2 What are ∅ ◦ ∅, ∅ ◦ X 2 , X 2 ◦ ∅, ∅ ◦ idX , idX ◦∅, X 2 ◦ X 2 , X 2 ◦ idX , idX ◦X 2 and
idX ◦ idX ?
−1
Exercise 0.3 What are idX −1 , ∅−1 and X 2
?
Exercise 1 For each of the following determine dom A, rng A, dom B, rng B, A−1 , B −1 and when
possible A ◦ B, A ◦ B −1 , A−1 ◦ B, A−1 ◦ B −1 and the domains and ranges of thereof.
1. X = {0, 1, 2}, Y = {1, 2}, A = {(0, 1), (2, 2)}, B = {(0, 2), (1, 1), (2, 1)}.
2. X = {0, 1, 2}, Y = {1, 2}, A = {(0, 1), (1, 2)}, B = {(0, 2), (1, 1), (2, 1)}.
3. X = Y = {0, 1}, A = idX , B = ∅.
4. X = Y = {0, 1}, A = {(0, 0), (1, 0)}, B = X 2 .
5. X = Y = {0, 1}, A = B = {(0, 0), (1, 0)}.
6. X = {−1, 0, 1}, Y = {0, 1, 2}, A = {(−1, 0), (−1, 1), (−1, 2), (0, 0), (0, 2)}.
7. X = {−1, 0, 1}, Y = {0, 1, 2}, A = {(−1, 0), (0, 1), (−1, 1), (0, 1), (1, 2)}.
8. X = Y = {1, 2, . . . , 10}, A = {(x, y) ∈ X 2 : x | y}, B = {(x, y) ∈ X 2 : 3 | y}.
9. X = Y = N, A = {(m, n) : m 6 n}, B = {(m, n) : m < n}.
10. X = Y = R, A = (x, y) : x2 + y 2 = 4 , B = (x, y) : x2 + y 2 = 1 .
11. X = Y = R, A = (x, y) : x2 + y 2 6 1 , B = {(x, y) : |x| + |y| = 1}.
1
Relation f is called a function, when
∀(x ∈ dom f ) ∀(y1 , y2 ∈ rng f )
(((x, y1 ) ∈ f ∧ (x, y2 ) ∈ f ) ⇒ y1 = y2 ) ,
or briefly
∀(x ∈ dom f ) ∃!(y ∈ rng f )
(x, y) ∈ f.
The notation f (x) = y and f : x 7→ y is frequently used for (x, y) ∈ f in this case.
Exercise 2 For each of the following decide if the relation defines a function with the given domain
(X). What is the range? Is the inverse relation a function? Why?
1. X = Y = {0, 1, 2}, f = {(0, 0), (1, 1), (2, 1)}.
12. X = Y = R, f = {(x, sin x) : x ∈ R}.
2. X = Y = {0, 1, 2}, f = {(0, 0), (1, 0)}.
13. X = Y = [0, π], f = {(x, sin x) : x ∈ X}.
3. X = Y = {0, 1, 2}, f = {(0, 0), (0, 1), (1, 2)}.
14. X = Y = [−π//2, π//2], f = {(x, sin x) : x ∈ X}.
4. X = Y = R, f = idR .
15. X = Y = R, f = {(x, tan x) : x ∈ R}.
5. X = Y , f = idX .
16. X = Y = Q \ {0}, f = {(x, tan x) : x ∈ X}.
6. X = Y = R, f = R2 .
17. X = Y = R, f =
7. X = Y = R, f = R × {2}.
18. X = Y = [−1, 1], f = (x, y) ∈ X 2 : x2 + y 2 = 1 .
8. X = Y = R, f = (R × {2}) ∪ {(1, 3)}.
19. X = Y = [0, 1], f = (x, y) ∈ X 2 : x2 + y 2 = 1 .
9. X = Y = R, f = {2} × R.
20. X = Y = [0, 1], f = (x, y) ∈ X 2 : max{x, y} = 1 .
21. X = Y = R, f = {(x, |x|) : x ∈ R}.
22. X = (0, ∞), Y = R, f = {(ey , y) : y ∈ Y }.
x, x3 : x ∈ R .
y2, y : y ∈ R .
10. X = Y = N, f = {(n, n!) : n ∈ X}.
11. X = Y = R, f =
23. X = Y = all convergent sequences, f = {(x, y) : x and y approach the same limit}.
24. X = all convergent sequences, Y = R, f = {({xn }n∈N , y) : limn→∞ xn = y}.
25. X = all convergent sequences, Y = R ∪ {−∞, ∞}, f = {({xn }n∈N , y) : limn→∞ xn = y}.
n
o
26. X = RR , all functions with R as the domain and with real values, Y = R, f = (g, limx→0 g) : g ∈ RR .
27. X
functions with R as the domain and with real values, Y = R, f =
n = C(R), all continuous
o
R
(g, limx→0 g) : g ∈ R .
Further reading.
http://cse.unl.edu/~choueiry/S06-235/files/Relations-HandoutNoNotes.pdf
http://www.cosc.brocku.ca/~duentsch/archive/methprimer1.pdf
http://people.ucsc.edu/~miglior/chapter%20pdf/Ch04_SE.pdf
http://www.mhhe.com/math/devmath/streeter/ia/graphics/streeter5ia/ch11/others/strI_11.1.
pdf
http://www.tutor-homework.com/Math_Help//college_algebra/m1l9notes.pdf
http://www.mathworksheetsgo.com/downloads/algebra-2/functions-and-relations/relation-functionworksheet.pdf
2
Solutions
Ex 1.2. We have dom A = {0, 1}, because 2 is not used as the first coordinate in A. Obviously,
rng A = Y , dom B = X and rng B = Y . To determine the inverses we just swap x and y in each pair
determining A and B:
A−1 = {(1, 0), (2, 1)},
B −1 = {(2, 0), (1, 1), (1, 2)}
The following four composites are possible:
A−1 ◦ B ⊂ X × X,
A ◦ B −1 ⊂ Y × Y,
B −1 ◦ A ⊂ X × X,
B ◦ A−1 ⊂ Y × Y.
To determine A−1 ◦B we need to follow first B and then A−1 . We do it step by step for all x ∈ dom B = X.
0. 0 goes to 2 with B and with A−1 this 2 goes to 1. So, (0, 1) ∈ A−1 ◦ B.
1. 1 goes with B to 1, and this 1 goes with A−1 to 0. Hence, (1, 0) ∈ A−1 ◦ B.
2. Finally, 2 goes with B to 1, and again 1 goes with A−1 to 0 resulting in (2, 0) ∈ A−1 ◦ B.
We conclude that
A−1 ◦ B = {(0, 1), (1, 0), (2, 0)}
and we see that dom(A−1 ◦ B) = X and rng(A−1 ◦ B) = {0, 1}, as 2 does not occur as the second
coordinate here.
To find A ◦ B −1 we follow B −1 and then A for every y ∈ dom B −1 = Y .
1. 1 is joined by B −1 to 1 and to 2. This 2 doesn’t go anywhere with A, but 1 goes to 2. So
(1, 2) ∈ A ◦ B −1 .
2. By B −1 our leftover 2 goes to 0, and this is lead to 1 by A. Thus, (2, 1) ∈ A ◦ B −1 .
And that’s it:
A ◦ B −1 = {(1, 2), (2, 1)},
and clearly dom(A ◦ B −1 ) = Y = rng(A ◦ B −1 ).
Ex 1.8. We have dom A = rng A = X, as every x ∈ X devides x (and hence, every x ∈ X is divisible
by itself). Moreover, dom B = X, because for example X × {6} ⊂ B (every x ∈ X is related to 6,
because B doesn’t care for x ∈ X, it only asks if y ∈ Y is a multiple of 3, which for y = 6 is certainly
true). On the other hand, rng B = {3, 6, 9}, as these are the only multiples of 3 in X. In fact we have
B = X × {3, 6, 9}.
The inverses of A and B are
n
o
n
A−1 = (x, y) ∈ {1, 2, . . . , 10}2 : y | x ,
o
B −1 = (x, y) ∈ {1, 2, . . . , 10}2 : 3 | x .
The equality X = Y allows us to establish all 8 possible compositions. For example
B ◦ A = {(x, z) ∈ X 2 : ∃(y ∈ X) (x | y ∧ 3 | z)}.
Clearly x can be any (all x’s devide something, for example themselves) and z ∈ {3, 6, 9} (z ∈ X needs
to be a multiple of 3). Hence B ◦ A = X × {3, 6, 9}.
For A ◦ B, we have
A ◦ B = {(x, z) ∈ X 2 : ∃(y ∈ X) (3 | y ∧ y | z)}.
So this one doesn’t care for x neither and it allows only z’s divisible by some multiple of 3, which is
equivalent to saying that those z’s are but multiples of 3. Hence, again A ◦ B = X × {3, 6, 9}.
n
o
A−1 ◦ B = (x, z) ∈ X 2 : ∃(y ∈ X) (3 | y ∧ z | y) .
3
A−1 ◦ B again doesn’t care for x for the same reason B didn’t care for it. But which z’s are acceptable?
Only those which divide some y, a multiple of 3. Multiples of 3 here are 3, 6 and 9. And their divisors
are 1, 2, 3, 6, 9. Therefore A−1 ◦ B = X × {1, 2, 3, 6, 9}. For example: why (5, 2) ∈ A−1 ◦ B? Does there
exist a y ∈ X such that 3 | y and 2 | y? Yes, 6 can be such a y.
n
o
A ◦ B −1 = (x, z) ∈ X 2 : ∃(y ∈ X) (3 | x ∧ y | z) .
Certainly, for every z ∈ X there is a y which divides it (y := z is ok). For x we can take only 3, 6 or 9.
Thus, A ◦ B −1 = {3, 6, 9} × X.
Ex 1.10. Points of A form a circle centred at 0, with radius 2. Therefore dom A = rng A = [−2, 2].
Similarly B is a circle concentric to A with radius 1, dom B = rng B = [−1, 1]. We have A = A−1 and
B = B −1 . Since X = Y , we can build any composition we like, but among them, only two are distinct:
A ◦ B and B ◦ A. For A ◦ B we have
n
A ◦ B = (x, z) ∈ R2 : ∃(y ∈ R)
o
x2 + y 2 = 1 ∧ y 2 + z 2 = 4
.
2
2
2
2
This makes sense for x ∈ [−1,
√ 1] and then we have y = 1 − x , so 1 − x + z = 4. We solve this for
z ∈ [−2, 2] obtaining z = ± 3 + x2 . Hence
A◦B =
n
p
o
x, ± 3 + x2 : x ∈ [−1, 1] .
For B ◦ A we have
n
B ◦ A = (x, z) ∈ R2 : ∃(y ∈ R)
o
x2 + y 2 = 4 ∧ y 2 + z 2 = 1
.
Clearly it’s the same as A ◦ B but with z and x commuted. So, B ◦ A = (A ◦ B)−1 :
B◦A=
n p
o
± 3 + z 2 , z : z ∈ [−1, 1] .
Ex 2.10. This is a function, as factorial is uniquely defined for any n ∈ N. The inverse relation is not,
as we have:
0! = 1
and
1! = 1,
by which f −1 leads 1 to both 0 and 1.
√
Ex 2.11. Clearly, both x3 and 3 x are uniqely defined for any x ∈ R, hence both f and f −1 are
functions. The same is true for any xn , when n is odd.
Ex 2.12. Here f is a function, while f −1 is not. Indeed, we have (0, 0) ∈ f and (π, 0) ∈ f .
Ex 2.14. Here both f and f −1 are functions. Let us look at sine as a ratio of lengths of the side
opposite to the angle and the hypotenuse in a right triange. Note that this is ok in [0, π/2]. If one
increases the angle keeping the opposite side constant, so increases the sine, as hypotenuse gets shorter.
Hence sine is increasing in [0, π/2]. Moreover, by the fact that sine is even, it follows that it is strictly
increasing in [−π/2, π/2]. Hence, there are no such two x’s for which the the values of sin x would be
equal.
Ex 2.15. This is not a function, as y is undefined for any π/2 + kπ, when k ∈ Z. Moreover, f −1 is
not a function either. We have (0.0) ∈ f and (π, 0) ∈ f .
n √
o
Ex 2.19. Surprisingly, both f and f −1 are functions. Indeed, f = x, 1 − x2 : x ∈ [0, 1] , while
f −1 = f .
4
© Copyright 2026 Paperzz