from a handpicked tutor in LIVE 1to1 classes
Onto Function
Onto function is a function f that maps an element x to every element y. That means, for every y, there is an x such that f(x) = y. Onto Function is also called surjective function. The concept of onto function is very important while determining the inverse of a function. In order to determine if a function is onto, we need to know the information about both the sets that are involved. Onto functions are used to project the vectors on 2D flat screens in a 3D video game.
Any function can be decomposed into an onto function or a surjection and an injection. In this article, let's learn about onto function definition and properties with examples.
What is an Onto Function?
An onto function is a function whose image is equal to its codomain. Also, the range and codomain of an onto function are equal. We can also say that function is onto when every y ∈ codomain has at least one preimage x ∈ domain. Let's go ahead and learn the onto function definition.
Onto Function Definition
A function f from set A to set B is called an onto function if for each b ∈ B there exists at least one a ∈ A such that f(a) = b. None of the elements are left out in the onto function because they are all mapped to some element of A. Consider the example given below:
Let A = {a_{1}, a_{2}, a_{3} } and B = {b_{1}, b_{2} } then f : A→B.
Onto Function Examples
For any onto function, y = f(x), all the elements in y should be mapped to any element in x. Here are few examples of onto functions.
 The identity function for any set X is an onto function.
 The function f : Z → {0, 1, 2} defined by f(n) = n mod 3 is an onto function.
Let us understand the concept of onto function using a reallife situation,
Consider a function representing the roll numbers of 15 students in a class. Here, the 15 students are the domain of the function, while their roll numbers constitute the codomain of the given function. Since, for every roll number in the system, there would be a student, this is an example of onto function.
Onto Function Formula
There is a formula to find the number of onto functions from one set to another. In onto function from A to B, we need to make sure that all the elements of B are used.
Formula For Number of Onto Functions
If A has m elements and B has n elements, then the total number of onto functions can be calculated using the formula,
\(\begin{equation}
n^{m}\left(\begin{array}{c}
n \\
1
\end{array}\right)(n1)^{m}+\left(\begin{array}{c}
n \\
2
\end{array}\right)\left(n2^{m}\right) \ldots \ldots . .(1)^{n1}\left(\begin{array}{c}
n \\
n1
\end{array}\right) 1^{m}
\end{equation}\)
We need to note that this formula will work only if m ≥ n. But if m < n, then the number of onto functions will be 0 as it is not possible to use all the elements of B.
Therefore,
 if n < m, number of onto functions = 0
 if n = m, number of onto functions = m!
Example to Calculate Number of Onto Functions:
Let us see how to find the number of onto functions using an example. If A has m elements and B has 2 elements, then the number of onto functions will be 2^{m } 2. This can be explained as:
 From a set of m elements in A to the set of 2 elements in B, the total number of functions will be 2^{m}.
 And, out of these functions, 2 functions are not onto, if all elements are mapped to the 1^{st} element of B or all elements are mapped to the 2^{nd }element of B.
 Thus, the total number of onto functions is 2^{m } 2.
Properties of Onto Function
A function is considered to be an onto function only if the range is equal to the codomain. Here are some of the important properties of onto function:
 In the onto function, every element in the codomain will be assigned to at least one value in the domain.
 Every function that is an onto function has a right inverse.
 Every function which has a right inverse can be considered as an onto function.
 A function f: A →B is an onto, or surjective, function if the range of f equals the codomain of the function f.
 Let f: A →B be an arbitrary function then, every member of A has an image under f and all the images will be considered as members of T. The set R of these images can be considered as the range of the function f.
Graph of Onto Function
The easiest way to determine whether a function is an onto function using the graph is to compare the range with the codomain. If the range equals the codomain, then the function is onto. A graph of any function can be considered as onto if and only if every horizontal line intersects the graph at least one or more points. If there is an element of the range of a function that fails the horizontal line test by not intersecting the graph of the function, then the function is not surjective. The belowgiven image is an example of the graph of onto function:
Relationship Between Onto Function and OnetoOne Function
In addition to onto function, the onetoone function is also an essential prerequisite for learning about inverse functions. Surjective and Injective functions are the different names for onto and onetoone functions, respectively. The primary difference is that onto functions hit all the output values, whereas onetoone functions are the ones where each x is connected to only one y.
A function that is both One to One and Onto is called the bijective function. Each value of the output set is connected to the input set, and each output value is connected to only one input value.
In the above image, you can see that each element on the left set is connected exactly once to each element in the right set, hence this function is one to one, and each element on the right set is connected to the left set, and thus it is onto as well. As it is both onetoone and onto, it is said to be bijective. For example, the function y = x is also both one to one and onto; hence it is bijective. Bijective functions are special classes of functions; they are said to have an inverse.
☛Related Articles on Onto Function
Check out the following pages related to onto function.
Important Notes on Onto Function
Here is a list of a few points that should be remembered while studying onto function.
 A function is onto when its range and codomain are equal.
 Any function can be decomposed into an onto function or a surjection and an injection.
Examples on Onto Function

Example 1: Let C = {1, 2, 3}, D = {4, 5} and let g = {(1, 4), (2, 5), (3, 5)}. Show that the function g is an onto function from C into D.
Solution: Domain = set C = {1, 2, 3}
We can see that the element from C,1 has an image 4, and both 2 and 3 have the same image 5. Thus, the Range of the function is {4, 5} which is equal to D. So we conclude that g: C →D is an onto function.

Example 2: How to tell if this function is an onto function? g : R → R defined by g(x) = 1 + x^{2}
Solution: Given the function g(x) = 1 + x^{2}.
For real numbers, we know that x^{2} > 0. So 1 + x^{2} > 1. g(x) > 1 and hence the range of the function is (1, ∞). Whereas, the second set is R (Real Numbers). So the range is not equal to codomain and hence the function is not onto.

Example 3: Check if the function g : R → R defined by g(x) = x^{2} is an onto function or not.
Solution:
Since, there is no real number x such that x^{2} = −1, therefore the given function is not an onto function. However, the function g : R → R ≥ 0 defined by g(x) = x^{2 }, with the restricted codomain is an onto function, since, for every y in the nonnegative real codomain Y, there is at least one x in the real domain X such that x^{2 }= y.
FAQs on Onto Function
What is Meant by Onto Function?
A function is onto function when its range and codomain are equal. We can also say that function is onto when every y ∈ codomain has at least one preimage x ∈ domain.
How Do You Know if a Function is an Onto Function?
A function g from set A to set B is called an onto function if for each b ∈ B there exists at least one a ∈ A such that g (a) = b. To show that g is an onto function, we can set y = g(x), and then solve for x, or we can also show that x can always be expressed in terms of y for any y ∈ B.
What is the Difference Between Onto and Into Functions?
One main difference between onto function and into the function is that, for onto function, each element of the output set B should definitely be connected to the elements in the input set A. Whereas for an into function, there should be at least one element in the output set B that should not be connected to the elements of the input set A.
How Do You Prove a Function is Not Onto?
In order to prove that a function is not onto, we should find an element in the codomain that is not the image of any element of the domain.
Can a Function Be Both One to One and Onto?
Yes, there can be a function that is both one to one and onto and it is called the bijective function. Each value of the output set is connected to the input set, and each output value is connected to only one input value.
What is the Other Name of the Onto Function?
Onto function is also called a surjective function. Any function can be decomposed into an onto function or a surjection and an injection.
What is the Difference Between OnetoOne vs Onto Functions?
Surjective and Injective functions are the different names for Onto and One to One functions, respectively. The primary difference is that Surjective functions hit all the output values, whereas Injective functions are the ones where each x is connected to only one y.
What are OneOne and Onto Functions?
Onetoone functions are special functions that return a unique range for each element in their domain while, onto functions are the functions with the range equal to the codomain.
How to Determine if the Function is Onto Function Using Graph?
The method to determine whether a function is an onto function using the graph is to compare the range with the codomain from the graph. If the range equals the codomain, then the given function is onto.
What is the Relation Between Codomain and Range for an Onto Function?
A function is considered to be an onto function only if the range is equal to the codomain. This is the relationship between the codomain and the range for an onto function.
visual curriculum