Professional Documents
Culture Documents
7 Fns Notes
7 Fns Notes
Functions
7.1 Basics
Definition 7.1.1. Let A, B be sets. A function or a map from A to B is a relation f from
A to B such that any element of A is f -related to a unique element of B, i.e.,
∀x ∈ A ∃y ∈ B (x, y) ∈ f ;
Remark 7.1.2. The negations of (F1) and (F2) can be expressed respectively as
(¬F1) ∃x ∈ A ∀y ∈ B (x, y) ̸∈ f ; and
(¬F2) ∃x ∈ A ∃y1 , y2 ∈ B (x, y1 ) ∈ f ∧ (x, y2 ) ∈ f ∧ y1 ̸= y2 .
Example 7.1.4. (1) r = {(x, y) ∈ R⩾0 × R⩾0 : x = y 2 } is a function R⩾0 → R⩾0 √ because
for every x ∈ R⩾0 , there is a unique y ∈ R⩾0 such that (x, y) ∈ r, namely y = x.
(2) r1 = {(x, y) ∈ R × R⩾0 : x = y 2 } is not a function R → R⩾0 because −1 ∈ R that is
not equal to y 2 for any y ∈ R⩾0 , violating (F1).
60
(3) r2 = {(x, y) ∈ R⩾0 × R : x = y 2 } is not a function R⩾0 → R because 1 ∈ R⩾0 and
−1, 1 ∈ R such that 1 = (−1)2 and 1 = 12 but −1 ̸= 1, violating (F2).
y •
r1 r
−1 x
1
r2
x
Question 7.1.5. Which of the arrow diagrams below represent a function from the LHS set 7a
to the RHS set?
7.2 Images
Definition 7.2.1. Let f : A → B.
(1) If x ∈ A, then f (x) denotes the unique element y ∈ B such that (x, y) ∈ f . We call
f (x) the image of x under f .
(2) The range of f , denoted range(f ), is defined by
Remark 7.2.2. It follows from the definition of images that if f : A → B and x ∈ A, then
for all y ∈ B,
(x, y) ∈ f ⇔ y = f (x).
Remark 7.2.3. (1) The range of a function is the set that contains all the outputs of the
function and nothing else, while the codomain is the set associated to the function as
part of its specification that contains all the outputs but maybe also other objects.
(2) For any function, the range is a subset of the codomain.
Example 7.2.4. The function r : R⩾0 → R⩾0 in Example 7.1.4(1) satisfies
Note that range(r) ⊇ R⩾0 , because for every y ∈ R⩾0 , there is x ∈ R⩾0 such that y = r(x),
namely x = y 2 . So range(r) = R⩾0 by Remark 7.2.3(2).
61
Example 7.2.6. We can represent the compound expression p∨q, where p, q are propositional
variables, using the Boolean function d : {T, F}2 → {T, F} where, for all p0 , q0 ∈ {T, F},
d(p0 , q0 ) is the truth value that p∨q evaluates to when one substitutes propositions
of truth values p0 and q0 into the propositional variables p and q respectively.
For instance, we have d(T, T) = T and d(F, F) = F. Hence range(d) = {T, F} by Re-
mark 7.2.3(2).
Proposition 7.2.7. Let f, g : A → B. Then f = g if and only if f (x) = g(x) for all x ∈ A.
7.3 Composition
Proof. (F1) Let x ∈ A. Use (F1) for f to find y ∈ B such that (x, y) ∈ f . Use (F1) for g
to find z ∈ C such that (y, z) ∈ g. Then (x, z) ∈ g ◦ f by the definition of g ◦ f .
(F2) Let x ∈ A and z1 , z2 ∈ C such that (x, z1 ), (x, z2 ) ∈ g ◦ f . Use the definition of g ◦ f
to find y1 , y2 ∈ B such that (x, y1 ), (x, y2 ) ∈ f and (y1 , z1 ), (y2 , z2 ) ∈ g. Then (F2) for f
implies y1 = y2 . So z1 = z2 as g satisfies (F2).
These show g ◦ f is a function A → C. Now, for every x ∈ A,
(x, f (x)) ∈ f and f (x), g(f (x)) ∈ g by the ⇐ part of Remark 7.2.2;
∴ (x, g(f (x))) ∈ g ◦ f by the definition of g ◦ f ;
∴ g(f (x)) = (g ◦ f )(x) by the ⇒ part of Remark 7.2.2.
62
Example 7.3.2. Let f, g : Z → Z such that for every x ∈ Z,
Definition 7.3.3. Let A be a set. Then the identity function on A, denoted idA , is the
function A → A which satisfies, for all x ∈ A,
idA (x) = x.
Remark 7.4.2. In view of Remark 7.2.2, one can formulate (F−1 1) and (F−1 2) for a general
relation f from A to B as follows:
(F−1 1) ∀y ∈ B ∃x ∈ A (x, y) ∈ f ;
(F−1 2) ∀x1 , x2 ∈ A ∀y ∈ B
(x1 , y) ∈ f ∧ (x2 , y) ∈ f ⇒ x1 = x2 .
By the definition of f −1 , these are equivalent respectively to (F1) and (F2) for f −1 , i.e.,
63
x
x
Figure 7.1: Surjectivity (left) and injectivity (right)
• ∀y ∈ B ∃x ∈ A (y, x) ∈ f −1 ; and
• ∀x1 , x2 ∈ A ∀y ∈ B (y, x1 ) ∈ f −1 ∧ (y, x2 ) ∈ f −1 ⇒ x1 = x2 .
Proof. In view of the discussion in Remark 7.4.2, conditions (F1), (F2), (1), and (2) for f
are equivalent respectively to conditions (1), (2), (F1), and (F2) for f −1 .
Example 7.4.4. The function f : Q → Q, defined by setting f (x) = 3x + 1 for all x ∈ Q, is
surjective.
Proof. Take any y ∈ Q. Let x = (y − 1)/3. Then x ∈ Q and f (x) = 3x + 1 = y.
Remark 7.4.5. A function f : A → B is not surjective if and only if
∃y ∈ B ∀x ∈ A (y ̸= f (x)).
g = f −1
⇔ ∀x ∈ A ∀y ∈ B g(y) = x ⇔ y = f (x) .
64
Proof.
g = f −1 (y, x) ∈ g ⇔ (y, x) ∈ f −1 as g, f −1 ⊆ B × A;
⇔ ∀y ∈ B ∀x ∈ A
by the definition of f −1 ;
⇔ ∀x ∈ A ∀y ∈ B (y, x) ∈ g ⇔ (x, y) ∈ f
⇔ ∀x ∈ A ∀y ∈ B g(y) = x ⇔ y = f (x) by Remark 7.2.2.
y = 3x + 1 ⇔ x = (y − 1)/3.
Let g : Q → Q such that g(y) = (y − 1)/3 for all y ∈ Q. The equivalence above implies
∀x, y ∈ Q y = f (x) ⇔ x = g(y) .
Tutorial exercises
7.1. Which of the following conditions are equivalent to the surjectivity of a function f : A →
B? For each positive answer, give a brief explanation. For each negative answer, give
a function f : {a, b} → {0, 1} that demonstrates the non-equivalence.
7.2. Which of the following conditions are equivalent to the injectivity of a function f : A →
B? For each positive answer, give a brief explanation. For each negative answer, give
a function f : {a, b} → {0, 1} that demonstrates the non-equivalence.
(a) For all x1 , x2 ∈ A, whenever x1 = x2 , we have f (x1 ) = f (x2 ).
(b) For all x1 , x2 , ∈ A, whenever x1 ̸= x2 , we have f (x1 ) ̸= f (x2 ).
(c) There are no elements x1 , x2 ∈ A such that x1 ̸= x2 and f (x1 ) = f (x2 ).
65
(d) There are distinct x1 , x2 ∈ A that make f (x1 ) = f (x2 ).
7.3. For all A, B ⊆ Z, define
RA,B = {(x, y) ∈ A × B : y = x2 − 1}
66
Hence ∀n ∈ Z+ P (n) is true by MI.
What is wrong with this proof?
Extra exercises
7.8. Let f = {(x, y) ∈ Q2 : y = ±x} and g = {(x, y) ∈ Q2 : y(x2 + 1) = 1}, viewed as
relations from Q to Q. Is f a function Q → Q? Is g a function Q → Q?
7.9. In this exercise, we prove a strong converse to Proposition 7.4.3.
Let f : A → B. Prove that, if the relation f −1 is a function B → A, then f is bijective.
7.10. Let f be as defined in Tutorial Exercise 7.4. Define g = {(x, n) ∈ Z2 : n = 2x}, viewed
as a relation from Z to Z.
(a) Prove that g is a function Z → Z.
(b) Is g surjective? Prove that your answer is correct.
(c) Is g injective? Prove that your answer is correct.
(d) Prove that f ◦ g = idZ but g ◦ f ̸= idZ .
(e) Is g = f −1 ? Explain your answer.
67