MM122 Sets and Relations Functions Definition Let A and B be sets

MM122 Sets and Relations
Functions
Definition
Let A and B be sets. A function or mapping f : A → B is a rule which associates, to each
element a ∈ A, a unique element b = f (a) ∈ B.
Terminology
Let f : A → B be a function. Then
the set A is called the domain of f ;
the set B is called the codomain of f ;
if b = f (a), then b is called the image of a and we may write a b ;
the set of all images of elements of A is called the image of f , im f :
im f = {b ∈ B : b = f (a) for some a ∈ A}.
The image of f is illustrated in the diagram below.
f
A
B
a
f(a)
im f
Formal Definition
Let A and B be sets. A function f : A → B is a subset f ⊆ A × B such that
(F1) ∀ a ∈ A ∃ b ∈ B : (a, b) ∈ f.
(F2) ∀ a ∈ A, b1, b2 ∈ B : (a, b1) ∈ f ∧ (a, b1) ∈ f ⇒ b1 = b2.
Composition of functions
Let f : A → B and g : B → C be two functions. If x ∈ A then y = f (x) belongs to B so we
can ‘apply’ the function g to y to get z = g(y) = g(f (x)) which belongs to C. In symbols:
x ∈ A ⇒ y = f (x) ∈ B ⇒ z = g(y) = g(f (x)) ∈ C.
This association x g( f ( x )) defines a function A → C, called the composite of f and g.
The composite function is denoted g f :
g f : A → C, g f (x) = g(f (x)).
The composite function g f is illustrated in the following diagram.
MM122 Functions
Page 1
f
A
B
g
C
y
x
z
gof
Properties of Functions
A function f : A → B is injective or one-one if different elements have different images; in
other words if we never have the following situation.
A
f
B
a1
b
a2
Definition
A function f : A → B is injective or one-one if a1 ≠ a2 ⇒ f (a1) ≠ f (a2); an equivalent and
easier to use condition to this is:
f (a1) = f (a2) ⇒ a1 = a2.
A function f : A → B is surjective or onto if every element of B is the image of some
element of A; more colloquially, f is surjective if every element of B is ‘hit’ by an arrow
coming from A. This is illustrated in the following diagram.
A
f
B
im f = B
Definition
A function f : A → B is surjective or onto if for every b ∈ B there exists a ∈ A such that
b = f (a); equivalently, if im f = B.
An injective function is also called an injection; a surjective function is also called a
surjection.
MM122 Functions
Page 2
Partial and Total Functions
A partial function f from A to B is a function in which f (a) need not be defined for
every a ∈ A. A partial function is sometimes denoted f : A → B. In other words, a partial
function is a subset f ⊆ A × B which satisfies condition (F2) but does not necessarily satisfy
condition (F1).
The domain, dom f , of a partial function A → B is the subset of A for which f (a) is
defined:
dom f = {a ∈ A : (a, b) ∈ f for some b ∈ B} .
A total function is what we have previously called simply a ‘function’; i.e., where f (a) is
defined for all a ∈ A.
The following diagrams illustrate partial and total functions.
f
A
B
A
f
B
dom f
dom f
Partial function
Total function
Bijective Functions and Inverse Functions
Definition
A function f : A → B is bijective (or is a bijection) if it is both injective and surjective.
If f : A → B is bijective, then ‘reversing the arrows’ defines a function B → A called the
inverse function of f . The inverse function is denoted f −1 .
This is illustrated in the following diagram.
A
MM122 Functions
f
B
A
f −1
B
Page 3
Definition
Suppose f : A → B is a bijective function. The function f −1 : B → A defined by
f −1 (b) = a ⇔ b = f (a)
is called the inverse function to f .
f
A
f
a = f −1(b)
−1
B
b = f(a)
Notes
1.
If f is injective but not surjective then f – 1 is still defined, but it is a partial function.
A
f
B
A
B
f −1 is a partial function
f is not surjective
2.
f −1
If f is not injective then ‘reversing the arrows’ does not define a function.
A
f
f is not injective
MM122 Functions
B
A
B
not a function
Page 4