Functions in Discrete Mathematics (original) (raw)

Last Updated : 23 Jul, 2025

Functions are an important part of discrete mathematics. This article is all about functions, their types, and other details of functions. A function assigns exactly one element of a set to each element of the other set. Functions are the rules that assign one input to one output. The function can be represented as f: A ** B. A is called the domain of the function and B is called the codomain function.

Table of Content

What is Function?

Pre-Image and Image of a Function

A function f: A ** B such that for each a ∈ A, there exists a unique b ∈ B such that (a, b) ∈ R then, a is called the pre-image of f and b is called the image of f.

Domain of a Function

Codomain (Range) of a Function

Read More about **Domain and Range of Function.

Types of Function

Some of the common types of functions are:

Let's discuss these in detail.

One-One Function ( or Injective Function):

A function in which one element of the domain is connected to one element of the codomain.

A function f: A ** B is said to be a one-one (injective) function if different elements of A have different images in B.

**f: A ⇢ B is one-one

**⇒ a ≠ b ⇒ f(a) ≠ f(b) for all a, b ∈ A

**⇒ f(a) = f(b) ⇒ a = b for all a, b ∈ A

ONE-ONE FUNCTION

ONE-ONE FUNCTION

Many-One Function

A function f: A ** B is said to be a many-one function if two or more elements of set A have the same image in B.

A function f: A ** B is a many-one function if it is not a one-one function.

**f: A ⇢ B is many-one.

**⇒ a ≠ b but f(a) = f(b) for all a, b ∈ A

MANY-ONE FUNCTION

MANY-ONE FUNCTION

Onto Function( or Surjective Function)

A function f: A ⇢ B is said to be onto (surjective) function if every element of B is an image of some element of A i.e. f(A) = B or range of f is the codomain of f.

A function in which every element of the codomain has one pre-image.

**f: A ⇢ B is onto if for each b∈ B, there exists a∈ A such that f(a) = b.

ONTO FUNCTION

ONTO FUNCTION

Into Function

A function f: A ** B is said to be an into a function if there exists an element in B with no pre-image in A.

A function f: A** B is into function when it is not onto.

INTO FUNCTION

INTO FUNCTION

One-One Correspondent Function (or Bijective Function or One-One Onto Function)

A function which is both one-one and onto (both injective and surjective) is called one-one correspondent(bijective) function.

**f : A ⇢ B is one-one correspondent (bijective) if:

ONE-ONE CORRESPONDENT FUNCTION

ONE-ONE CORRESPONDENT FUNCTION

One-One Into Function

A function that is both one-one and into is called one-one into function.

ONE-ONE INTO FUNCTION

ONE-ONE INTO FUNCTION

Many-One Onto Function

A function that is both many-one and onto is called many-one onto function.

MANY-ONE ONTO FUNCTION

MANY-ONE ONTO FUNCTION

Many-One Into Function

A function that is both many-one and into is called many-one into function.

MANY-ONE INTO FUNCTION

MANY-ONE INTO FUNCTION

Inverse of a Function

Let f: A ** B be a bijection then, a function g: B ** A which associates each element b ∈ B to a different element a ∈ A such that f(a) = b is called the inverse of f.

**f(a) = b ↔︎ g(b) = a

Read More about **Inverse Function.

Composition of Functions

Let f: A ** B and g: B ** C be two functions then, a function gof: A ** C is defined by

****(gof)(x) = g(f(x)), for all x ∈ A**

Here, (gof)(x) is called the composition of f and g.

Read More about **Composition of Function.

Summary: Functions in Discrete Mathematics

Let X and Y be two sets with m and n elements and a function is defined as f : X⇢Y then,

For the composition of functions f and g be two functions :

Sample Questions on Functions in Discrete Mathematics

**Question 1: Show that the function f : R ⇢ R, given by f(x) = 2x, is one-one and onto.

**Solution:

**For one-one:

Let a, b ∈ R such that f(a) = f(b) then,

f(a) = f(b)

⇒ 2a = 2b

⇒ a = b

**Therefore, f: R ⇢ R is one-one.

**For onto:

Let p be any real number in R (co-domain). f(x) = p

⇒ 2x = p

⇒ x = p/2

p/2 ∈ R for p ∈ R such that f(p/2) = 2(p/2) = p

For each p∈ R (codomain) there exists x = p/2 ∈ R (domain) such that f(x) = y

For each element in codomain has its pre-image in domain.

So, f: R ⇢ R is onto.

Since f: R ⇢ R is both one-one and onto.

f : R ⇢ R is one-one correspondent (bijective function).

**Question 2: Let f : R ⇢ R ; f(x) = cos x and g : R ⇢ R ; g(x) = x 3 . Find fog and gof.

**Solution:

Since the range of f is a subset of the domain of g and the range of g is a subset of the domain of f. So, fog and gof both exist.

**gof (x) = g(f(x)) = g(cos x) = (cos x)3 = cos3x

**fog (x) = f(g(x)) = f(x3) = cos x3

**Question 3: If f : Q ⇢ Q is given by f(x) = x 2 , then find f -1 (16).

**Solution:

Let f-1(16) = x

f(x) = 16

⇒ x2 = 16

⇒ x = ± 4

Thus, f-1(16) = {-4, 4}

**Question 4: If f : R ⇢ R; f(x) = 2x + 7 is a bijective function then, find the inverse of f.

**Solution:

Let x ∈ R (domain), y ∈ R (codomain) such that f(a) = b

f(x) = y

⇒ 2x + 7 = y

⇒ x = (y -7)/2

⇒ f-1(y) = (y -7)/2

Thus, f-1 : R ⇢ R is defined as f-1(x) = (x -7)/2 for all x∈ R.

**Question 5: If f : A ⇢ B and |A| = 5 and |B| = 3 then find total number of functions.

**Solution:

Total number of functions = 35= 243