Types of Functions - GeeksforGeeks

Types of Functions

Last Updated : 29 Oct, 2026

Functions are defined as the relations that give a particular output for a particular input value. A function has a domain and a codomain. The range is the set of all actual outputs. f(x) usually denotes a function where x is the input of the function. In general, a function is written as y = f(x).

Let A and B be two nonempty sets. A function or mapping f from A to B is written as f: A → B is a rule by which each element a ∈ A is associated with a unique element b ∈ B.

function

Domain, Codomain, and Range

The elements of set X are called the domain of f and the elements of set Y are called the codomain of f. The images of the elements of set X are called the range of function, which is always a subset of Y. The image given below demonstrates the domain, codomain, and range of the function.

domain

The image demonstrates the domain, co-domain, and range of the function. Remember the element which is mapped only will be counted in the range as shown in the image. The domain, codomain, and range of the above function are:

  • Domain = {a, b, c}
  • Codomain = {1, 2, 3, 4, 5}
  • Range = {1, 2, 3}

Representation

There are three different forms of representation of functions. The function needs to be represented to showcase the domain values and the relationship between them. The function can be represented in algebraic form, graphical formats, and other roster form.

  • Algebraic Form: A function is usually denoted by the equation y = f(x) which connects the values on the y-axis.
  • Graphical Form: Functions are easy to understand if they are represented in a graphical form with the help of coordinate axes, which helps us to understand the changing behavior of the function if the function is increasing or decreasing.
  • Roster Form: Roster notation of a set is a simple mathematical representation of the set in mathematical form. In this notation, a function is represented with a set in mathematical form. In this notation, a function is represented with a set of points on its graph with the first and second element of domain and range respectively.

There are several types of functions in maths. Some of the important types are:

1. One to One (Injective) function

A function f: X → Y is said to be a one-to-one function if the images of distinct elements of X under f are distinct. Thus, f is one to one if f(x1) = f(x2)

  • Property: A function f: A → B is one-to-one if f(x1) = f(x2) implies x1 = x2, i.e., an image of a distinct element of A under f mapping (function) is distinct.
  • Condition to be One-to-One function: Every element of the domain has a single image with a codomain after mapping.
one_to_one_function

Examples of One-to-One Functions

  • f(x) = x (Identity function)
  • k(x) = 2x + 3 (Linear Polynomial)
  • g(x) = ex (Exponential function)
  • h(x) = √x​ (Square root function, defined for x ≥ 0)

2. Many to One Function

If the function is not one to one function, then it should be many-one function means every element of the domain has more than one image at codomain after mapping.

  • Property: One or more elements having the same image in the codomain
  • Condition to be Many to One function: Two or more elements of the domain have the same image in the codomain.
many_to_one_function

Examples of Many to One Function

Some of the most common examples of many-to-one functions are:

3. Onto (Surjective) Function

A function f: X → Y is said to be an onto function if every element of Y is an image of some element of set X under f, i.e. for every y ∈ Y there exists an element x in X such that f(x) = y.

Properties:

  • The range of functions should be equal to the codomain.
  • Every element of B is the image of some element of A.

Condition to be onto function: The range of function should be equal to the codomain.

onto_function

As we see in the above two images, the range is equal to the codomain means that every element of the codomain is mapped with the element of the domain, as we know that elements that are mapped in the codomain are known as the range. So these are examples of the Onto function.

Examples

Some of the most common examples of onto functions are:

  • f(x) = x (Identity function)
  • g(x) = ex (Exponential function)
  • h(x) = sin(x) (Sine function within a limited domain, e.g., h: R→[−1,1])
  • k(x) = cos(x) (Cosine function within a limited domain, e.g., k : [0,π]→[−1,1])
  • m(x) = x3 (Cubic function)

4. Into Function

A function f: X → Y is said to be an into a function if there exists at least one element or more than one element in Y, which does not have any pre-images in X, which simply means that every element of the codomain is not mapped with elements of the domain.

Properties:

  • The Range of function is the proper subset of B
  • The Range of functions should not equal B, where B is the codomain.
into_function

From the above image, we can see that every element of the codomain is not mapped with elements of the domain means the 10th element of the codomain is left unmapped. So this type of function is known as the Into function.

Examples

Some examples of functions you can consider are:

  • f(x) = sin(x) where f: R→[−1, 1] is not onto because it doesn't cover all values in the interval [−1, 1].
  • g(x) = x2 where g: R→R+ (positive real numbers) is not onto because it doesn't map to any negative real numbers.
  • h(x) = ex where h: R→(0,∞) is not onto because it doesn't map to zero.

Practice Questions on Function Mapping

Other Types of Functions

Types of Functions Based on Algebraic Form

  1. Linear Function: A function of the form f(x) = mx + c.
  2. Quadratic Function: A function of the form f(x) = ax2 + bx + c, where a ≠ 0.
  3. Polynomial Function: A function expressed as a polynomial in x.
  4. Rational Function: A ratio of two polynomials, where the denominator is nonzero.
  5. Absolute Value Function: A function such as f(x) = |x|.
  6. Radical Function: A function involving roots, such as f(x) = \sqrt{x}.
  7. Reciprocal Function: A function such as f(x) = \frac{1}{x}, where x ≠ 0.

Types of Functions Based on Mathematical Properties

  1. Even Function: (f(-x) = f(x)).
  2. Odd Function: (f(-x) = -f(x)).t
  3. Increasing Function: The output increases as the input increases.
  4. Decreasing Function: The output increases as the input increases.
  5. Periodic Function: The output increases as the input increases.
  6. Bounded Function: A bounded function has outputs that remain within fixed upper and lower limits.
  7. Composite Function: A function formed by applying one function to the output of another.
  8. Inverse Function: A function that reverses the action of another function, when the inverse exists.
Comment

Explore