Unit04
Unit04
Overview
• What is a function?
• Domain, image, range
• One-to-one, Onto, Bijective
• Inverse function
• Composite function
• Non-functions
• Some useful functions:
➢floor, ceiling, exponential, log, mod
• Cardinality of infinite sets: Countable / Uncountable
• Functions with more than 1 argument
3
Functions
• Let A and B be sets. A function 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 element of B assigned to
the element a of A.
Basic terminology
Consider a function f from A to B.
• A is the domain of f. A B
• B is the codomain of f.
• We write f : A → B
• If f(a) = b, b is the image of a.
• The range of f is the set comprising the images of
elements of A.
I.e., { b | b B and ( a f(a) = b ) }.
Example 1
Consider a function f2: ℤ → ℕ such that,
for any a ℤ, f2(a) = a2.
• Is f2 one-to-one?
• Is f2 onto?
Example 1 (cont’)
Consider a function f2: ℤ → ℕ such that,
for any a ℤ, f2(a) = a2.
• Is f2 one-to-one?
No. Let x = -2 and y = 2.
Then, f(x) = (-2)2 = 4 and f(y) = 22 = 4.
Therefore, x y f2(x) f2(y) is false.
• Is f2 onto?
No. Let b = 2.
b = f2(a) 2 = a2
a = 2 or − 2
Therefore, there does not exist a ℤ such that f2(a) = b.
8
Example 2
Consider a function f3: ℤ → ℤ such that,
for any a ℤ, f3(a) = a-1.
• Is f3 one-to-one?
Yes. Let x and y such that f3(x) = f3(y).
x-1 = y -1
x=y
• Is f3 onto?
Yes. For any b ℤ,
b = f3(a) a-1 = b
a = b+1
aℤ
• Therefore, f3 is bijective.
9
f
Inverse functions A
f -1
B
2. Recall that f3(a) = a+1 for any a ℤ. What is the inverse of f3?
Composite functions A
g
B
f
C
Consider two functions
g : A → B and f : B → C.
The composition of f and g, denoted by f g, is a function
from A to C, defined as follows.
For any a A, f g (a) = f( g (a) ).
Note that g f may not be well-defined.
Non-functions
• If f(a) = b has more than one value or no value of b for a
particular a, then f is a non-function (i.e., not a function).
➢ f is just a relation that relates a to b.
Function or non-function?
1. 𝑓: ℝ → ℝ such that 𝑥 = (𝑓 𝑥 )2 .
Non-function. When 𝑥 = 4, 𝑓 𝑥 = 2 or − 2.
Exponential Functions
• f(x) = bx is the exponential function for the base b, where
b 1 and b 0.
• f : ℝ → ℝ+
• E.g., when the base b = 2, f(x) = 2x.
• logb(xy) = y logb x
Proof. Let p = logb x. Then,
x = bp (by definition of log)
xy = (bp)y = bpy
logb(xy) = py (by definition of log)
logb(xy) = y logb x
18
Proof. Let
By definition of log,
19
• •
•
•
•
•
20
Countable or not?
• The set of all (HKMU) Computing students who were
admitted in the year 2020.
• ℕ = {0, 1, 2, …}
Countable or not?
ℤ = the set of all integers (including –ve integers)
• Therefore, ℤ is countable.
25
• Assume B is infinite.
• Since A is countable, there exists a bijection f from ℕ to A.
• The elements of A can be enumerated (written down) in
the order of
f(0), f(1), f(2), f(3), f(4), f(5), f(6), f(7), f(8), …
26
• Assume B is infinite.
• Since A is countable, there exists a bijection f from ℕ to A.
• The elements of A can be enumerated (written down) in the
order of
f(0), f(1), f(2), f(3), f(4), f(5), f(6), f(7), f(8), …
Claim: g is bijective.
Lemma 1. g is one-to-one.
Proof.
Consider any i, j ℕ.
g(i) = g(j)
f(ai) = f(aj) (as g(i) = f(ai) and g(j) = f(aj) )
ai = aj (as f is one-to-one)
i = j (as ai’s are all distinct)
Therefore, g is one-to-one.
28
Claim: g is bijective.
Lemma 2. g is onto.
Proof.
Consider any element x B.
As B A, x A.
Because f is onto, there exists i ℕ such that f(i) = x.
Theorem 3. g is bijective.
Proof.
By Lemma 1, g is one-to-one.
By Lemma 2, g is onto.
Therefore, g is bijiective.
What is x?
• Recall that 𝑓 is a bijective function from ℕ to R.
We can enumerate elements of R in order, e.g.,
• 𝑓(0) = 0.111
• 𝑓(1) = 0.33333…
• 𝑓(2) = 0.5
• …
𝑓(0) = 0. 1 1 1
𝑓(1) = 0. 3 3 3 …
𝑓(2) = 0. 5 0 0
…
x= 0. 2 4 1 …
• x = 0.241… Such x 𝑓(i) for all integers i.
32
What is x?
Notation: For any real number y R, for any integer i 0, let
yi be the (i+1)-th digit after the decimal point.
Proof.
By Theorem 3, if the set of real numbers is countable, then
R (which is a subset of real numbers) is also countable.