# Onto Function

A function is something, which relates elements/values of one set to the elements/values of another set, in such a way that elements of the second set is identically determined by the elements of the first set. A function has many types which define the relationship between two sets in a different pattern. They are various types of functions like one to one function, onto function, many to one function, etc.

## Onto Function Definition (Surjective Function)

Onto function could be explained by considering two sets, Set A and Set B which consist of elements. If for every element of B there is at least one or more than one element matching with A, then the function is said to be **onto function** or surjective function. The term for the surjective function was introduced by Nicolas Bourbaki.

In the first figure, you can see that for each element of B there is a pre-image or a matching element in Set A, therefore, its an onto function. But if you see in the second figure, one element in Set B is not mapped with any element of set A, so it’s not an onto or surjective function.

### Properties of a Surjective Function (Onto)

- We can define onto function as if any function states surjection by limit its codomain to its range.
- The domain is basically what can go into the function, codomain states possible outcomes and range denotes the actual outcome of the function.
- Every onto function has a right inverse
- Every function with a right inverse is a surjective function
- If we compose onto functions, it will result in onto function only.

### Onto Function Example Questions

**Example**: Let A={1,5,8,9) and B{2,4} And f={(1,2),(5,4),(8,2),(9,4)}. Then prove f is a onto function.

**Solution:** From the question itself we get,

A={1,5,8,9)

B{2,4}

& f={(1,2),(5,4),(8,2),(9,4)}

So, all the element on B has a domain element on A or we can say element 1 and 8 & 5 and 9 has same range 2 & 4 respectively.

Therefore, f: A \(\rightarrow\) B is an surjective fucntion.

Hence, the onto function proof is explained.

### Number of Onto Functions (Surjective functions) Formula

If we have to find the number of onto function from a set A with n number of elements to set B with m number of elements, then;

\((^{m}_{0})m^{n}\,-\,(^{m}_{1})(m-1)^{n}\,+\,(^{m}_{2})(m-2)^{n}\,-\,(^{m}_{3})(m-3)^{n}\,+\,.\,.\,.\,.\,.\,.\) |

When n<m, the number of onto function = 0

And when n=m, number of onto function = m!

We can also write the number of surjective functions for a given domain and range as;

m^{n }– m + m ((m – 1)^{n }– (m – 1)) |