Functions
Discrete Mathematics
Definition: Function
Definition
LetAand B be non empty sets. A functionf fromAto B is an assignment ofexactly one element of B to each element ofA. We writef(a) =b if b is the unique element of B assigned by the functionf to the elementaof A. If f is a function fromAto B, we writef :A→B.
A B
f
f
a b =f(a)
Definitions: Domain, Codomain, Image, Preimage and Range
Definition
Iff is a function fromAto B, we say that Ais the domain off andB is the codomainof f.
Iff(a) =b, we say that b is theimage ofa andais thepreimage ofb.
Therange off is the set of all images of elements of A.
Also, Iff is a function fromAto B, we say that f mapsA toB.
A B
f
f
a b =f(a)
Definition: Image of a Subset
Definition
Letf be a function from the setA to the setB and let S be a subset ofA. Theimage of S under the function f is the subset of B that consists of the images of the elements of S. We denote the image ofS byf(S), so
f(S) ={t ∈B | ∃s ∈Swith (t =f(s))}.
We also use the shorthandf(S) ={f(s)|s ∈S}to denote this set.
x y z a
b c
f
A B
S f(S)
Example
x y z a
b c d
f
A B
S f(S)
The domain of f is A={a,b,c,d}.
The codomain off is B ={x,y,z}.
f(a) =z.
The image of ais z.
The preimages of z are a, c andd.
The range of f is f(A) ={y,z} ⊆ B.
The image of the subset S ={c,d} ⊆Ais f(S) ={z} ⊆B.
Definition: One-To-One (Injective) Function
Definition
A functionf from AtoB is said to beone-to-one, orinjective, if and only iff(a) =f(b) implies thata=b for all a andb in the domainA. A function is said to be an injectionif it is injective.
By taking the contrapositive of the implication in this definition, a function is injective if and only ifa6=b implies f(a)6=f(b).
Another way to understand it, a function is injective means that if an element of the codomain has a preimage, then it is a unique preimage.
Definition: Onto (Surjective) Function
Definition
A functionf fromA toB is called onto, or surjective, if and only if for every elementb∈B there is an elementa∈A with
f(a) =b. A functionf is called asurjection if it is surjective.
Another way to understand it, a function is surjective means that each element of the codomain has at least one preimage.
Definition: One-To-One Correspondence (Bijective) Function
Definition
The functionf is aone-to-one correspondenceif it is both one-to-one and onto.
The functionf is is said to bebijective if it is both injective and surjective. A function is said to be abijection if it is bijective.
Example 1
a
f
A B
z y x w
c b
Isf injective?
Isf surjective?
Isf bijective?
Example 2
x y z a
b c d
f
A B
Isf injective?
Isf surjective?
Isf bijective?
Example 3
a b c d
f
A B
z y x w
Isf injective?
Isf surjective?
Isf bijective?
Example 4
a b c d
f
A B
z y x w
Isf injective?
Isf surjective?
Isf bijective?
Example 5
a
f
A B
z y x w
c b
Isf injective?
Isf surjective?
Isf bijective?
Venn Diagram of Function Classification
Relations
Surjections Bijections
Injections
Functions
Addition and Product of Functions
Definition
Letf1 andf2 be functions from AtoR. Thenf1+f2 andf1f2 are also functions fromAto Rdefined by
(f1+f2)(x) =f1(x) +f2(x), (f1f2)(x) =f1(x)f2(x).
Definition: Composition of Functions
Definition
Letg be a function from the set Ato the set B, and let f be a function from the setB to the setC. Thecomposition of the functionsf and g, denoted byf ◦g, is defined by
(f ◦g)(a) =f(g(a)).
A g B f C
a g g(a) f f(g(a))
f ◦g
Definition: Inverse Function
Definition
Letf be a bijection from the setA to the setB. Theinverse functionoff is the function that assigns to an elementb
belonging toB the unique element a inA such thatf(a) =b. The inverse function off is denoted byf−1. Hence,f−1(b) =a when f(a) =b. The inverse function is also a bijection.
A B
f
f b =f(a)
f−1
f−1 a=f−1(b)
Identity Function
Definition
Identity function(also called identity mapping): The identity mapping1X :X →X is the function with domain and codomain X defined by
1X(x) =x, ∀x∈X.
Left and Right Inverse
Definition
Letf :X →Y be a fonction with domainX and codomain Y , andg :Y →X be a fonction with domainY and codomain X. The functiong is aleft inverse off if g◦f =1X.
The functiong is aright inverse of f iff ◦g =1Y.
The functiong is an inverseof f ifg is both a left and right inverse off. When f has an inverse, it is often writtenf−1.
Left and Right Inverse
Theorem
A function is injectiveif and only if it has aleft inverse.
A function is surjectiveif and only if it has aright inverse.
A function is bijectiveif and only if it has an inverse.
If a function has an inverse, then this inverse is unique.
Note: The left and right inverses are not necessarily unique.