Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
Relations and Functions
Definition 1. For two items a and b, we define the ordered pair of them as the set
(a, b) = {a, {a, b}}.
If A and B are sets, we define the cartesian product between them as
A × B = {(a, b) : a ∈ A and b ∈ B}.
The reason this, a priori weird, definition is chosen is so that we have
(a, b) = {a, {a, b}} =
6 {b, {a, b}} = (b, a).
So while it is true that {a, b} = {b, a}, we also have (a, b) 6= (b, a). Moreover {a} =
6 (a, a).
Example 2. Find the cartesian products of A = {0, 1, 2} and B = {3, 4}.
A × B = {(0, 3), (0, 4), (1, 3), (1, 4), (2, 3), (2, 4)}
B × A = {(3, 0), (3, 1), (3, 2), (4, 0), (4, 1), (4, 2)}.
Thus we also see that A×B 6= B ×A in general (when could we have A×B = B ×A?).
Definition 3. A relation between sets A and B is a subset R ⊆ A × B. Some relations
have special names:
(injective (left definite)) (∀a, a0 ∈ A)(∀b ∈ B)((a, b) ∈ R ∧ (a0 , b) ∈ R ⇒ a = a0 )
(functional (right definite)) (∀a ∈ A)(∀b, b0 ∈ B)((a, b) ∈ R∧(a, b0 ) ∈ R ⇒ b = b0 )
(left total) (∀a ∈ A)(∃b ∈ B)((a, b) ∈ R)
(surjective (right total)) (∀b ∈ B)(∃a ∈ A)((a, b) ∈ R).
In the case where A = B and R ⊆ A × B = A × A, we also have special relations:
(reflexive) (∀a ∈ A)((a, a) ∈ R)
(symmetric) (∀a, b ∈ A)((a, b) ∈ R ⇒ (b, a) ∈ R)
(antisymmetric) (∀a, b ∈ A)(a 6= b ∧ (a, b) ∈ R ⇒ (b, a) 6= R)
(transitive) (∀a, b, c ∈ A)((a, b) ∈ R ∧ (b, c) ∈ R ⇒ (a, c) ∈ R)
(trichotomous) (∀a, b ∈ A), we have exactly one of the following: (a, b) ∈ R,
(b, a) ∈ R, or a = b.
A partial ordering is a relation which is reflexive, antisymmetric, and transitive. An
equivalence relation is a relation which is reflexive, symmetric, and transitive. A
function between A and B is a relation which is functional and left total.
1
Example 4. ≤ is a partial ordering on the set of natural numbers. Note that it satisfies
the three required properties: n ≤ n (reflexivity), if n 6= m and n ≤ m, m 6≤ m
(antisymmetric), and if k ≤ n and n ≤ m, then k ≤ m (transitivity). = is an equivalence
relation on the natural numbers: n = n (reflexivity), n = m implies m = n (symmetry),
and k = n and n = m imply k = m (transitivity).
The set f = {(n, n2 ) : n ∈ N} is a function between N and N. It is left total, since
for all n ∈ N, there exists an m ∈ N such that (n, m) ∈ f. Namely, m = n2 . And it is
functional since if (n, n2 ), (n, k 2 ) ∈ f, then we must have n2 = k 2 by definition of f.
To simplify notation for functions, we often write f (x) = y to denote that (x, y) ∈ f.
We also may write f : X → Y to denote that f ⊂ X × Y is a function between X and Y.
Definition 5. Let f : X → Y be a function. We define the image (or range) of f as
im f = ran f = f (X) = {y ∈ Y : (∃x ∈ X)(f (x) = y)}.
If y ∈ Y, we define the preimage of y as
f −1 (y) = {x ∈ X : f (x) = y}.
A function is injective if it is an injective relation. It is surjective if it is a surjective
relation. It is bijective if it is injective and surjective.
Proposition 6. Let f : X → Y be a function. f is surjective iff im f = Y.
Proof. If f is surjective, then it is a surjective relation. So we have that if y ∈ Y,
then there exists an x ∈ X such that (x, y) ∈ f, or in function notation, f (x) = y. But
then by definition of image, this means y ∈ im f. Since y was arbitrary, we thus have
Y ⊆ im f. But obviously im f ⊆ Y, so im f = Y.
If im f = Y, then for all y ∈ Y, y ∈ im f and hence there exists an x ∈ X for which
f (x) = y (i.e. (x, y) ∈ f ). So f is a surjective relation and is hence surjective.
2
Example 7. Consider the following table of functions f : R → R.
injective? surjective?
f (x)
2
x
no
no
.
x2 (x − 1)
no
yes
x
e
yes
no
x
yes
yes
f (x) = x2 is not injective since f (−1) = f (1), but 1 6= −1. It is not surjective since if I
choose −1 ∈ R, there is no x ∈ R such that f (x) = −1.
f (x) = x2 (x − 1) is not injective since f (0) = f (1), but 0 6= 1. It is surjective though
since im f = R (one can use a cubic formula to find the preimage of any real number).
f (x) = ex is injective since if ex = ey , then x = y (apply ln to both sides). It is not
surjective since ex > 0, so in particular if I choose 0 (or any negative number), there is
no x such that ex = 0.
f (x) is bijective. It is injective since if f (x) = f (y), then obviously x = y. Moreover
every real number has a preimage: itself (since f (x) = x).
Proposition 8. Let f : A → B and g : B → Z. Then there is a function g ◦ f : A → C,
called the composition of g with f, defined by (g ◦ f )(a) = g(f (a)).
2
Proof. We need to show g ◦ f is a function. First note that it is left total, since if
a ∈ A, then (g ◦ f )(a) = g(f (a)) ∈ C. It is also functional, since if (g ◦ f )(a) = c and
(g ◦ f )(a) = c0 , then since f is a function, f (a) can only be one element of B. And since g
is a function, its outputs are also unique. Thus the outputs of g ◦ f are unique, so c = c0 .
So g ◦ f is a function.
2
Proposition 9. Let f : A → B and g : B → C be functions.
(a) If g ◦ f is surjective, then g is surjective.
(b) If g ◦ f is injective, then f is injective.
Proof. (a) Suppose g ◦ f is surjective. Then im g ◦ f = C. Let c ∈ C. Then by
surjectivity of g ◦ f, there is an a ∈ A such that g(f (a)) = c. But then f (a) ∈ B is an
element that maps to c under g. That is, if k = f (a), then g(k) = c. So g is surjective.
(a) Suppose g ◦ f is injective. Let a, a0 ∈ A and suppose f (a) = f (a0 ). Then
g(f (a)) = g(f (a0 )). But since g ◦ f is injective, this implies a = a0 . Hence f is injective.
2
Definition 10. Let f : A → B and g : B → A. g is called the inverse of f if g(f (a)) = a
and f (g(b)) = b for all a ∈ A and all b ∈ B. In this case, we write g = f −1 .
Hence by the above proposition, any injective function f : A → B yields a bijection
f : A → im f.
3