1. Sets and Relations
1.2. Relations and Functions
After introducing some of the basic elements of set theory (sets), we will move on to the
second most elementary concept, the concept of relations and functions.
Definition 1.2.1: Relation 

Let A and B be two sets. A relation between
A and B is a collection of ordered pairs (a, b) such that a
A and b
B. Often we use the notation a ~ b to
indicated that a and b are related, rather then the order pair notation
(a, b).

Note that this does not mean that
each element from
A needs to be
associated with one (or more) elements from
B. It is sufficient if
some
associations between elements of
A and
B are defined. In contrast,
there is the definition of a function:
Definition 1.2.2: Function, Domain, and Range 

Let A and B be two sets. A function f from A
to B is a relation between A and B such that for each a
A there is one and only
one associated b B. The
set A is called the domain of the function, B is called its
range.
Often a function is denoted as y = f(x) or simply f(x),
indicating the relation { (x, f(x)) }.

Examples 1.2.3: 

 Let A = {1, 2, 3, 4}, B = {14, 7, 234}, C = {a, b, c},
and R = real numbers. Define the following relations:
 r is the relation between A and B that associates the pairs 1 ~
234, 2 ~ 7, 3 ~ 14, 4 ~ 234, 2 ~ 234
 f is the relation between A and C that relates the pairs
{(1,c), (2,b), (3,a), (4,b)}
 g is the relation between A and C consisting of the associations
{(1,a), (2,a), (3,a)}
 h is the relation between R and itself consisting of pairs
{(x,sin(x))}

Which of those relations are functions ?

The outcomes of a function (i.e. the elements from the range associated to elements in the
domain) do not only depend on the rule of the function (such as
x is associated with
sin(x)) but also on the domain of the function. Therefore, we need to specify those
outcomes that are possible for a given rule and a given domain:
Definition 1.2.4: Image and Preimage 

Let A and B be two sets and f a function from A to
B. Then the image of f is defined as
 imag(f) = {b B :
there is an a A with
f(a) = b}.
Let A and B be two sets and f a function from A to
B. If C is a subset of the range B then the
preimage, or inverse image, of C under the function f is the
set defined as
 f ^{1}(C) =
{x A : f(x)
C }

As an example, consider the following functions:
Example 1.2.5: 

 Let f(x) = 0 if x is rational and f(x) = 1 if x is
irrational. This function is called Dirichlet’s Function. The range for f
is R.

Find the image of the domain of the Dirichlet Function when:
 the domain of f is Q
 the domain of f is R
 the domain of f is [0, 1] (the closed interval between 0 and 1)

What is the preimage of R ? What is the preimage of [1/2, 1/2] ?
 Let f(x) = x^{2}, with domain and range being R.
Then use the graph of the function to determine:

What is the image of [0, 2] and the preimage of [1, 4] ?

Find the image and the preimage of [2, 2].

Functions can be classified into three groups: those for which every element in the image
has one preimage, those for which the range is the same as the image, and those which
have both of these properties. Accordingly, we make the following definitions:
Definition 1.2.6: Oneone, Onto, Bijection 

A function f from A to B is called one to one (or one
one) if whenever f(a) = f(b) then a = b. Such functions are also called
injections.
A function f from A to B is called onto if for all b in
B there is an a in A such that f(a) = b. Such functions are also called
surjections.
A function f from A to B is called a bijection if it is one
to one and onto, i.e. bijections are functions that are injective and surjective.

Examples 1.2.7: 


If the graph of a function is known, how can you decide whether a
function is onetoone (injective) or onto (surjective) ?

Which of the following functions are oneone, onto, or bijections ? The domain for
all functions is R.
 f(x) = 2x + 5
 g(x) = arctan(x)
 g(x) = sin(x)
 h(x) = 2x^{3} + 5x^{2}  7x + 6
