BrightChamps Logo
Login
Creative Math Ideas Image
Live Math Learners Count Icon100 Learners

Last updated on July 21st, 2025

Math Whiteboard Illustration

Onto Function

Professor Greenline Explaining Math Concepts

An onto function is a type of mapping where each element in the codomain set has a corresponding element in the domain set. In this article, we will discuss onto function, its properties, composition, and how to represent it.

Onto Function for Indonesian Students
Professor Greenline from BrightChamps

What is an Onto Function?

Functions are used to represent relationships between two sets. A function f: A → B is said to be onto if every element in the codomain B is the image of at least one element in the domain.

Professor Greenline from BrightChamps

Difference Between Onto and Into Function

Functions can be classified as onto or into based on how the elements of the domain are mapped to elements in the codomain. With the help of the table below, let’s look at the differences between the functions.

 

Onto Function Into Function
  • A function is onto if every element in the co-domain is mapped to at least one element in the domain
  • In into function, at least one element in the co-domain is not mapped by any element in the domain.
  • It is represented using the symbol ↠
  • It is represented using the symbol ↣
  • For example, let f: {1, 2, 3, 4} → {w, x, y, z}, where: f(1) = w, f(2) = x, f(3) = y, f(4) = z. Here, every element in the codomain is mapped to the function, so this is an onto function.
  • For example, let f:{1, 2, 3} → {w, x, y, z}, where: f(1) = w, f(2) = x, f(3) = y. Here, the element z is not mapped with f, so it is an into function.
Professor Greenline from BrightChamps

Number of Onto Functions Formula

To calculate the number of onto functions from set A to set B, assume that set A has n elements and set B has m elements. 
Let: 
|A| = n
|B| = m

 

The number of onto functions from A to B can be calculated using the formula:

Number of onto functions = total number of functions - number of functions that are not onto

 

The total number of functions from A to B = mn 

The number of onto functions = 
mn -   1m (m - 1)n + 2m (m - 2)n + .... + (-1)mm -1  m (0)n

 

The number of onto functions is 0 if n < m

If n = m, then the number of onto functions is m! 

Professor Greenline from BrightChamps

What are the Properties of Onto Function?

A function is called onto whenever an element of the codomain is mapped to at least one element from the domain. The onto function follows certain properties; by understanding these properties, we can identify the functions. 

 

  • In an onto function, each element of the codomain is associated with at least one element from the domain; that is, no element in the codomain remains unmapped.

 

  • If a function has a right inverse, then it must be onto.

 

  • In an onto function, the range and co-domain are equal.

 

  • Not all onto functions are one-to-one. 
Professor Greenline from BrightChamps

Composition of Onto Function

The composition of a function in mathematics is an operation that combines two functions to create a new function. If any two functions are onto functions, then their composition is also onto. For example, if two onto functions, f: A → B and g: B → C, their composition is (g∘f): A → C is also an onto function.

 

This is because every element in C is mapped to B through the function g, and every element in B is mapped to A through the function f. So, composition (g∘f) has element C mapped to A. 

Professor Greenline from BrightChamps

How to Represent Onto Function Graphically?

Representing a function in a graph is the easiest way to compare the range with the co-domain. So, to verify whether the function is onto, we use a graph. A function is onto if every horizontal line intersects the graph at least once. This indicates that every value in the codomain is mapped to at least one element in the domain. 

Professor Greenline from BrightChamps

Relationship Between Onto Function and One-to-One Function

Understanding one-to-one and onto functions is important when learning about inverse functions. A one-to-one function is also known as an injective function, and an onto function is also known as a surjective function. The main difference between these functions is that every co-domain is mapped with at least one domain, whereas in a one-to-one function, each element in the co-domain is mapped to a unique element in the domain.
If a function is both onto and one-to-one is called bijective. It means that each element in the domain is mapped to a unique element in the codomain. Each element in the codomain set is the image of some element from the domain set.

Professor Greenline from BrightChamps

Real-World Applications of Onto Function

An onto function is one in which every element of the co-domain is the image of at least one element from the domain. In real life, we use the onto function in different fields like science, technology, cryptography, etc. Let’s learn them in detail. 

 

  • To schedule events, assign tasks, or resources, we use the onto function to ensure every need is met. For example, in schools to allocate seats to students we can use onto function where students (domain) and the seats(co-domain), so that each seat is assigned at least one student.

 

  • In cryptography, a cryptographic system may use a function that maps messages to encrypted code so that every possible encrypted output is generated.

       
  •  In economics, we use onto function to model the distribution of resources to demand, to ensure it reaches all. 
Max Pointing Out Common Math Mistakes

Common Mistakes and How to Avoid Them in Onto Function

Students often confuse different types of functions, as they have similarities, and this confusion can lead to mistakes. Here are common mistakes students made with the onto function and how to avoid them. 

Mistake 1

Red Cross Icon Indicating Mistakes to Avoid in This Math Topic

Confusing onto for a one-to-one function
 

Green Checkmark Icon Indicating Correct Solutions in This Math Topic

Confusing onto with one-to-one function is common among students as they think all onto functions are one-to-one functions. The main difference between them is that in a one-to-one function, no co-domain is associated with the same domain, but in an onto every co-domain should be mapped to at least one domain. 

Mistake 2

Red Cross Icon Indicating Mistakes to Avoid in This Math Topic

Not verifying all co-domain elements 

Green Checkmark Icon Indicating Correct Solutions in This Math Topic

Students sometimes consider a function to be onto without verifying if all elements in the co-domain are mapped to at least one element domain. This can lead to errors, so always verify whether every element y in the co-domain is mapped to at least one element x in the domain. That means to check if f(x) = y has a solution for every y in the codomain.

Mistake 3

Red Cross Icon Indicating Mistakes to Avoid in This Math Topic

Assume that all linear equations represent an onto function

Green Checkmark Icon Indicating Correct Solutions in This Math Topic

Assume that all the linear functions in the form f(x) = mx + b are onto without verifying their domain and co-domain. To avoid this error, list down the domain and co-domain before checking if it is onto or not, and also ensure that m ≠ 0 in f(x) = mx + b.

Mistake 4

Red Cross Icon Indicating Mistakes to Avoid in This Math Topic

Errors when using the graph test

Green Checkmark Icon Indicating Correct Solutions in This Math Topic

When applying the horizontal line test to check if it is an onto function, students are incorrect. To avoid this confusion, always remember that to check if the graph is onto, check if every horizontal line intersects the graph at least once.

Mistake 5

Red Cross Icon Indicating Mistakes to Avoid in This Math Topic

Confusing range as co-domain

Green Checkmark Icon Indicating Correct Solutions in This Math Topic

Students often believe that the range and co-domain are always identical, but this is only true for onto functions. To avoid this confusion, remember that the co-domain of a function is defined as f: A → B, and the range is {f(x) | x ∈ A}. 

arrow-right
Max from BrightChamps Saying "Hey"

Solved Examples on Onto Function

Ray, the Character from BrightChamps Explaining Math Concepts
Max, the Girl Character from BrightChamps

Problem 1

Verify whether the function is onto or not. Let f: R → R be defined as f(x) = 2x + 3.

Ray, the Boy Character from BrightChamps Saying "Let’s Begin"

The function f is onto 

Explanation

The function f: R → R is defined by f(x) = 2x + 3. 

Where x and y are real numbers. Assume f(x) = y then, 

2x + 3 = y

x = (y - 3)/2

As x ∈ R for every y ∈ R in x = (y -3)/2 

So, f is an onto function

Max from BrightChamps Praising Clear Math Explanations
Max, the Girl Character from BrightChamps

Problem 2

Check if g is an onto function from C → D, where C = {1, 2, 3} and D = {4, 5}, and let g = {(1, 4), (2, 5), (3, 5)}

Ray, the Boy Character from BrightChamps Saying "Let’s Begin"

The function g is onto

Explanation

Given, 

C = {1, 2, 3}

D = {4, 5}

g = {(1, 4), (2, 5), (3, 5)}

Here, all the elements in set D are mapped with g; the function g is an onto function.

Max from BrightChamps Praising Clear Math Explanations
Max, the Girl Character from BrightChamps

Problem 3

Let f: R → R, f(x) = 2x and g: R → R, g(x) = x + 1. Is g∘f onto?

Ray, the Boy Character from BrightChamps Saying "Let’s Begin"

The function g∘f is onto.

Explanation

Given,

f: R → R, f(x) = 2x
 
g: R → R, g(x) = x + 1

So, g∘f(x) =g(f(x)) = g(2x)

= 2x + 1
 

A function is said to be onto when each element of the co-domain is mapped to at least one element from the domain. 

Checking if x ∈ R in g∘f(x) = y

That is, 2x + 1 = y

2x = y - 1

x = (y - 1)/2

So, the function g∘f is an onto function

Max from BrightChamps Praising Clear Math Explanations
Max, the Girl Character from BrightChamps

Problem 4

If f: R → R, f(x) = 5x - 7, is f onto?

Ray, the Boy Character from BrightChamps Saying "Let’s Begin"

Yes, the function f is onto.

Explanation

For any y ∈ R, 

5x - 7 = y 

5x = y - 7

x = (y - 7)/5

Therefore, every real y is associated with x, such that f(x) = y. So f is an onto function.

Max from BrightChamps Praising Clear Math Explanations
Max, the Girl Character from BrightChamps

Problem 5

Consider the function h: {1, 2, 3, 4} → {5, 6, 7, 8} defined as follows: h(1) = 5, h(2) = 6, h(3) = 7, and h(4) = 8. Verify if the function is onto?

Ray, the Boy Character from BrightChamps Saying "Let’s Begin"

The function h is onto

Explanation

Here, 

h: {1, 2, 3, 4} → {5, 6, 7, 8} 

D = {5, 6, 7, 8}

Where, h(1) = 5

h(2) = 6

h(3) = 7

h(4) = 8

The function is onto, as all the elements in D are mapped by h

Max from BrightChamps Praising Clear Math Explanations
Ray Thinking Deeply About Math Problems

FAQs on Onto Function

1.What is an onto function?

Math FAQ Answers Dropdown Arrow

2.How to check if a function is onto?

Math FAQ Answers Dropdown Arrow

3.Can a function be onto and one-to-one?

Math FAQ Answers Dropdown Arrow

4.What is an into function?

Math FAQ Answers Dropdown Arrow

5.What is the relationship between range and co-domain in an onto function?

Math FAQ Answers Dropdown Arrow

6.How does learning Algebra help students in Indonesia make better decisions in daily life?

Math FAQ Answers Dropdown Arrow

7.How can cultural or local activities in Indonesia support learning Algebra topics such as Onto Function?

Math FAQ Answers Dropdown Arrow

8.How do technology and digital tools in Indonesia support learning Algebra and Onto Function?

Math FAQ Answers Dropdown Arrow

9.Does learning Algebra support future career opportunities for students in Indonesia?

Math FAQ Answers Dropdown Arrow
Math Teacher Background Image
Math Teacher Image

Jaskaran Singh Saluja

About the Author

Jaskaran Singh Saluja is a math wizard with nearly three years of experience as a math teacher. His expertise is in algebra, so he can make algebra classes interesting by turning tricky equations into simple puzzles.

Max, the Girl Character from BrightChamps

Fun Fact

: He loves to play the quiz with kids through algebra to make kids love it.

INDONESIA - Axa Tower 45th floor, JL prof. Dr Satrio Kav. 18, Kel. Karet Kuningan, Kec. Setiabudi, Kota Adm. Jakarta Selatan, Prov. DKI Jakarta
INDIA - H.No. 8-2-699/1, SyNo. 346, Rd No. 12, Banjara Hills, Hyderabad, Telangana - 500034
SINGAPORE - 60 Paya Lebar Road #05-16, Paya Lebar Square, Singapore (409051)
USA - 251, Little Falls Drive, Wilmington, Delaware 19808
VIETNAM (Office 1) - Hung Vuong Building, 670 Ba Thang Hai, ward 14, district 10, Ho Chi Minh City
VIETNAM (Office 2) - 143 Nguyễn Thị Thập, Khu đô thị Him Lam, Quận 7, Thành phố Hồ Chí Minh 700000, Vietnam
Dubai - BrightChamps, 8W building 5th Floor, DAFZ, Dubai, United Arab Emirates
UK - Ground floor, Redwood House, Brotherswood Court, Almondsbury Business Park, Bristol, BS32 4QW, United Kingdom