SEHH2241 Lecture 5
SEHH2241 Lecture 5
1 Functions
Let A and B be nonempty sets. A function (or map/mapping) f from A to B is an assignment of
exactly one element of B to each element of A. We write f (a) = b if b is the unique element of B
assigned by the function f to the element a ∈ A. If f is a function from A to B,we write f : A → B.
Moreover, we say that A is the domain of f and B is the codomain of f . In addition, we may write
f
f (a) = b by a 7→ b or a 7→ b when the map f is clear.
Definition 1. Suppose f : A → B.
(2) The codomain B of f is the set where the outputs belong to.
range(f ) := {f (x) : x ∈ A} .
f (A′ ) = {f (a) ∈ B : a ∈ A′ }.
(5) the inverse image (or pre-image) of a subset B ′ ⊆ B is the subset of A defined by
f −1 (B ′ ) = {x ∈ A : f (x) ∈ B ′ }.
1
a
2
b
3
c
4
d
1
In general, we can illustrate a function by
f
a f (a)
f
range(f )
A B
2 Operators on Functions
g◦f
f g
A B C
2
f
A B
g
g◦f
C
Figure 4: Commutative diagram.
Then g ◦ f : R → R is given by
(1) associative: h ◦ (g ◦ f ) ≡ (h ◦ g) ◦ f ≡ h ◦ g ◦ f .
(2) noncommutative: g ◦ f 6= f ◦ g
(1) the identity function idA : A → A defined by idA (x) := x for every x ∈ A.
(2) the ceiling function ⌈·⌉ : R → Z defined by ⌈x⌉ := min{n ∈ Z : n ≥ x} = the least integer
greater than or equal to x.
(3) the floor function ⌊·⌋ : R → Z defined by ⌊x⌋ := max{n ∈ Z : n ≤ x} = the greatest integer
less than or equal to x.
given A ⊆ U.
3
For example, if A = {5, π, −3.2}, then
4 Injectivity
f (a) = f (b)
=⇒ 3a + 1 = 3b + 1
=⇒ 3a = 3b
=⇒ a = b.
Example. The function g : R → R given by g(x) = x2 is NOT injective since f (1) = f (−1) but
1 6= −1. However, if we restrict the domain and codomain of g to R>0 , then g is injective
g(a) = g(b)
=⇒ a2 = b2
=⇒ a2 − b2 = 0
=⇒ (a − b)(a + b) = 0
=⇒ a = b or a = − b (rej.)
=⇒ a=b
4
Definition 5 (Increasing and Decreasing Functions). Let f : A → R and I ⊆ A be an interval.
Then we say
Proof. We first suppose f is strictly increasing. Consider the equality f (a) = f (b). If a < b, then
f (a) < f (b) by assumption. Similarly, if a > b, then f (a) > f (b). Therefore the only case for
f (a) = f (b) is when a = b. The case of f being strictly decreasing is similar.
5 Surjectivity
Example. The function f : R → R given by f (x) = 3x + 1 is surjective since for every y ∈ R, there
y−1
exists x = such that
3
y−1
f (x) = 3 + 1 = (y − 1) + 1 = y.
3
Example. The function f : R → R given by f (x) = n2 is not onto since there exists y = −1 ∈ R
such that for every x ∈ R, f (x) 6= −1.
f : A → B is surjective ⇐⇒ range(f ) = B
5
Proof. (=⇒) Suppose f : A → B is surjective. To show range(f ) = B, we need to show both
range(f ) ⊆ B and B ⊆ range(f ). Fortunately, the inclusion range(f ) ⊆ B is automatically true by
the definition of the range of a function. To show B ⊆ range(f ), since f is surjective, then every
y ∈ B implies y = f (x) for some x ∈ A, hence y = f (x) ∈ range(f ).
(=⇒) Suppose range(f ) = B. Then every element y in B is also an element in range(f ). Therefore
for every y ∈ B, we can write y = f (x) for some x ∈ A, which is just the definition of onto.
6 Bijectivity
or equivalently,
g ◦ f ≡ idA and f ◦ g ≡ idB .
f
a = f −1(b) f (a) = b
f −1
A B
6
1 1 1
a a a
2 2 2
b b b
3 3 3
c c c
4
one-to-one, not onto d one-to-one and onto
onto, not one-to-one
1 1
a a
2 2
b b
3 3
c c
4
not a map
neither one-to-one nor onto
and
y−1 y−1
(f ◦ g)(y) = f (g(y)) = f =3 + 1 = (y − 1) + 1 = y.
3 3
Note that such function g is unique. Indeed, the inverse of any invertible function f : A → B is
unique.
Proof. Suppose there are two inverses g and h of a function f : A → B, i.e. (g ◦ f )(x) = x for every
x ∈ A and (f ◦ h)(y) = y for every y ∈ B. Then for every y ∈ B,
g(y) = g ((f ◦ h)(y)) = (g ◦ (f ◦ h)) (y) = ((g ◦ f ) ◦ (h)) (y) = (g ◦ f )(h(y)) = h(y)
7
Exercise 1. Determine whether the following functions are injective, surjective or bijective.
(b) one-to-one but not onto. (d) neither one-to-one nor not onto.
(c) if f and g are bijective, then so does g ◦ f . Moreover, find the inverse of g ◦ f .
8
Exercise 4. Let A = 2Z and B = {2n + 1 : n ∈ Z}. Define two functions f : A × B → B × A
and g : B × A → B × B by
Exercise 5. Let f : Z → Z be a function such that f (m+n) = f (m)+f (n) and f (−n) = −f (n).
Show that
(a) f (0) = 0.
(b) f is injective if and only if f (n) = 0 has unique solution n = 0. (Hint: Apply the result
from part(a) in only-if part.)
7 Cardinalities
Definition 8. A set S is called finite if it has only finite number of elements; otherwise, it is
called infinite. Denote the number of elements of S by |S|, called the cardinality of S.
(b) |A × B| = |A||B|.
For any two finite sets, we can determine whether they have the same cardinality by computing each
of the cardinality. However this doesn’t work for infinite cases. Therefore, we need to find a definition
that works for two sets, both finite or both infinite, having the same cardinality.
9
Definition 9. Let A and B be sets. Then |A| = |B| if there exists a bijection f : A → B.
Example. Consider the following two sets A = {1, 2, 3, · · · } and B = {0, 1, 2, 3, · · · }. Intuitively, the
set B looks like it has one more element than the set A. However, one can define a map f : A → B
by f (n) = n − 1. This map f is indeed a bijection (exercise :)). Hence |A| = |B|.
Exercise 8. State whether each of the following statements is always true or sometimes
false. If it is true, give a proof. Otherwise, give a counter example or reason.
10