10 Functions I
10 Functions I
Introduction
Functions are one of the critical data types that occurs everywhere in mathe-
matics, statistics, and computer science. They provide the means to transport
information from one set to another.
Learning Objectives
• Define a function using both the set-theoretic and traditional f :
A → B notation, and in particular be able to talk about the data of
a function and what functions represent.
• Define the image and preimage of a set under a function. Be able to
compute and prove (pre-)images for relatively simple functions.
• Define the (left, right, two-sided) inverse of a function and compute
such inverses for simple functions.
We didn’t do much with these definitions at the time, but we will now. The
following is the definition of a function. While it may look different than that
with which you are familiar, it is nonetheless the same!
Definition 2
If A and B are two sets, a function f from A to B is a left-total, functional
binary relation on A and B. In this case, A is said to be the domain of f ,
and B is the codomain of f .
Let’s unravel what this means. If A = {2, 4, 6} and B = {♡, ♢}, then S =
{(2, ♡), (4, ♡), (6, ♢)} defines a left-total and functional relation which we’ll call
f . But instead of writing 2f ♡, the notation with which you’re more familiar is
to write f (2) = ♡. Similarly, f (4) = ♡ and f (6) = ♢. This allows us to interpret
what left-total and functional actually mean:
• left-totality says that a function must be defined for every element of its
domain,
• functionality says that an element of the domain can only map to one
element in the codomain (the “vertical line test”).
Functions 2
Notice that this is exactly the set which defines the relation f !
Exercise 5 Which, if any, of the following functions are equal to one an-
other?
1. f : {0, 1} → R, x 7→ x
2. g : {0, 1} → R, x 7→ x2
3. h : {0, 1} → {0, 1} , x 7→ x.
Definition 6
Let f : A → B be a function.
1. If U ⊆ A, then we define the image of U to be
f (U ) = {y ∈ B : ∃x ∈ U, f (x) = y} = {f (x) : x ∈ U } .
f −1 (V ) = {x ∈ A : f (x) ∈ V } .
Note that despite being written as f −1 (V ), the preimage of a set does not
say anything about the existence of an inverse function.
3 Functions
A B
f :A→B
f (U )
U
Example 7
Solution. By definition, one has f ([−1, 2]) = {f (x) : x ∈ [−1, 2]}, which we claim
is [0, 4]. Indeed, let’s show a double subset inclusion. Suppose that y ∈ [0, 4]
√
and let x = y. We know that x exists since y ≥ 0 and that x must live in
[0, 2] ⊆ [−1, 2]. Thus f (x) = y, showing that y ∈ f ([−1, 2]).
On the other hand, suppose that x ∈ [−1, 2] so that −1 ≤ x ≤ 2. It follows
that 0 ≤ x2 ≤ 4 (why?), so that f ([−1, 2]) ⊆ [0, 4]. Both inclusions show that
f ([−1, 2]) = [0, 4]. ■
Example 8
D = (x, y) ∈ R2 : x2 + y 2 ≤ 1 ,
Solution. While it’s not a strictly correct picture, we can think of p as a projection
map, taking a three-dimensional shape and squishing it into the xy-plane. If we
think of p like this, then the pre-image of D is the set of things which get squished
into D; namely, the solid cylinder
C = (x, y, z) : x2 + y 2 ≤ 1 .
(x0 , y0 , z0 ) ∈ C showing that p−1 (D) ⊆ C. Both inclusions give the desired
equality. ■
S = (x, y, z) : x2 + y 2 + z 2 = 1 ⊆ R3 ,
determine p(S).
The word “inverse” has many different meanings depending on the context in
which it is used. For example, what if we were to ask you to find the inverse of
the number 2? What does this mean? To what are we taking the inverse? To
properly understand this, we need to understand the following: Given a binary
operator (an operator which takes in two things and produces a single thing
in return, such as addition and multiplication of real numbers), we say that a
number id is the identity of that operator if operating against it does nothing
to the input. In the case of addition of real numbers, the operator will satisfy
x + id+ = x for all possible x; for example,
Our experience tells us that id+ = 0. Similarly, for multiplication the identity
id× will satisfy x × id× = x for all x; for example,
3 × id× = 3, π × id× = π.
Again our experience tells us that id× = 1. We say that 0 is the additive identity
and 1 is the multiplicative identity.
Given an operator and an identity, we say that the inverse of x is an element
which, when paired against x, gives the identity. The additive inverse of 2 is the
number y such that 2 + y = id+ = 0. In this case y = −2, and more generally the
additive inverse of n is −n. For multiplication, we can convince ourselves that
the multiplicative inverse of x is 1/x; for example, 2 × (1/2) = 1 = id× .
Notice that every real number has an additive inverse, while there is no mul-
tiplicative inverse for the number 0. In general, one cannot be guaranteed that
an inverse always exists for a generic binary operator.
5 Functions
Definition 11
If A, B, C are sets, and f : B → C and g : A → B are functions, we define
the composition of f and g to be the function
(f ◦ g) : A → C, x 7→ f (g(x)).
f −1 (f (x)) = idA
◦ (x) = x, f (f −1 (y)) = idB
◦ (y) = y.
Definition 12
Let f : S → T be a function. We say that g : T → S is a
• left-inverse of f if g(f (s)) = s for all s ∈ S,
• right-inverse of f if f (g(t)) = t for all t ∈ T ,
• inverse of f if it is both a left- and right-inverse. We denote the
inverse of f as f −1 .