Function
Function
DISCRETE MATHEMATICS
S.E.(COMPUTER) SEM-IV
FUNCTIONS
➢ TYPES OF FUNCTIONS
➢ INVERTIBLE FUNCTIONS
➢ SPECIAL FUNCTIONS
FUNCTIONS
Functions
Let A and B be two non-empty sets. A function f from A to B is a relation from A to B such that for each
a ∈ A, there is a unique b ∈ B such that (a,b) ∈ f.
We write b = f(a) and read as b is called the image of a under f
a is called the preimage of b.
A function is denoted by f: A→ B.
A B
f
a b
Observations:
(i) Every a in A belongs to some pair (a,b) in f and if (a1, b1) ∈ f and (a1,b2)∈ f , then b1 = b2,
(ii) An element b ∈ B need not have a preimage in A . If b ∈ 𝐵 has a preimage a ∈ 𝐴, the preimage need not be
unique. i.e two elements of A can have the same image in B.
FUNCTIONS
Equal functions:
Let f : A→ B and g : A → 𝐵. We say f = g iff f(a)= g(a) ∀ a ∈ 𝐴.
Example: Let A and B be finite sets with m and n elements respectively. How many
functions are possible from A to B?
Solution: Let A = {a1,a2 , …, am}
B = {b1,b2,…,bn}
A function f: A→ B is of the form
f = {(a1, x),(a2 , x), ……(am ,x) where x→some bj ∈ B
Since there are n number of bj’s , there are n choices for x in each of the m ordered pairs
belonging to f.
∴ The total possible no. of choices for x is n x n x ……n (m factors)= nm
Therefore, there are nm functions from set A to set B.
FUNCTIONS
Types of functions:
One-One (injective): A function f: A→ B is said to be one-one(injective) if distinct elements of A
have distinct images in B.
i.e. if f(x1)= f(x2), then x1 = x2 for x1,x2 𝜖 A
Example 6: Let f: R→ R given by f(x)=2x + 3. Show that f is bijective where R is the set of real numbers
Solution: Suppose f(x1) = f(x2 )
2x1 + 3 = 2x2 + 3
⟹ 2x1 = 2x2
⟹ x1 = x2
∴ f is one-one
Let y ∈ R
𝑦 = 2𝑥 + 3
𝑦 − 3 = 2𝑥
𝑦−3
2
=𝑥
𝑦−3
For each y ∈ 𝑅 , ∃ x = 2 such that f(x)= y
∴ f is onto. Hence, f is bijective.
FUNCTIONS
Identity function: A function f: A→ A defined by f(x) =x ∀ 𝑥 ∈ 𝐴 is called the identity function. An
identity function is bijective.
Composition of functions: Let A,B,C be three non-empty sets and f: A→ B and g: B→ C . The
composition of f and g denoted by 𝑔 ∘ 𝑓 is the function 𝑔 ∘ 𝑓: 𝐴 → 𝐶 defined by
𝑔∘𝑓 𝑥 =𝑔 𝑓 𝑥 ∀𝑥 ∈𝐴.
A B C
𝑔∘𝑓
a f b g c
Note: In general, g ∘ f ≠ f ∘ g
FUNCTIONS
𝑥+1
Example 3: Let f: R–{1} → R – {1} given by 𝑓 𝑥 = . Show that 𝑓 ∘ 𝑓 𝑥 = 𝑥
𝑥−1
𝑥+1
Solution: 𝑓 ∘ 𝑓 𝑥 = 𝑓 𝑓 𝑥 =𝑓
𝑥−1
𝑥+1 𝑥+1+𝑥−1
+1 2𝑥
𝑥−1 𝑥−1
= 𝑥+1 = 𝑥+1−𝑥+1 = =𝑥
−1 2
𝑥−1 𝑥−1
Example 4: Let f, g :R→ R defined by f(x)= ax + b and g(x) = cx + d . Determine for which
constants f ∘ g = g ∘ f, where a,b,c,d are constants.
Solution: f ∘ g(x)= f(g(x)) = f(cx + d)= a(cx +d)+ b = acx + ad + b
g ∘ f(x)= g(f(x))= g(ax +b) = c(ax +b)+ d = acx + bc + d
If f ∘ g = g ∘ f
⟹ acx + ad +b = acx + bc + d
ad – bc = d –b
𝑎 𝑏
=𝑑−𝑏
𝑐 𝑑
FUNCTIONS
Theorem: If f: A→ B and g: B→ C are bijective functions, then g ∘ f : A→ 𝐶 is also
a bijective function.
Proof: Suppose g ∘ f (x1) = g ∘ f (x2 ) x1,x2 ∈ 𝐴
⟹ g(f(x1))= g(f(x2))
⟹ f(x1)= f(x2) since g is one-one
⟹ x1 = x2 since f is one-one
∴ g ∘ f is one –one
Let c ∈ C
Since g: B→ C is onto, ∃ b ∈ B such that g(b) = c
Since b ∈ B and f: A→ B is onto, ∃ a ∈ A such that f(a) = b
c= g(b) = g(f(a))= g∘f(a)
∴ For any c ∈ 𝐶 , ∃ 𝑎 ∈ 𝐴, such that g∘f(a)=c
∴ g ∘ f is onto.
Hence, g ∘ f : A → C is bijective.
FUNCTIONS
Inverse function: Let f:A→ B be a bijective function. The inverse function of f ,
denoted by f-1 is a function f-1 : B→ A that assigns to each b ∈ B a unique element
a ∈ A such that f(a) = b.
Example: Let f, g : R → R given by f(x)= x3 and g(x)= x 1/3 . Show that f and g are inverses of each
other.
Solution: f ∘ g: R → R
f ∘ g (x) = f(g(x))= f(x1/3) = (𝑥 1Τ3 )3 = x = iR (x)
∴ f ∘ g = iR
g ∘ f: R→ R
g ∘ f(x)= g (f(x))= g (x3 ) = (𝑥 3 )1Τ3 = x= iR (x)
g ∘ f= iR
∴ f and g are inverses of each other.
2. Ceiling function: Let x be a real number The ceiling function assigns to x the smallest integer
greater than or equal to x . It is denoted by 𝑥 .
𝑥 = n ⟹ n -1 ≤ 𝑥 ≤ n
Examples:
a. 8 =8 8 =8
b. 1.5 = 1 1.5 = 2
c. −3 = −3 −3 = −3
d. −6.2 = −7 −6.2 = −6
e. −0.5 = −1 −0.5 = 0
f. 0.5 = 0 0.5 =1
FUNCTIONS
3. Characteristic function: Let A be a subset of a universal set U. The characteristic
function of A, denoted by fA : U→ [0,1] defined as
fA (x) = 1 if x ∈ A
=0 if x ∉ A