# Onto Function – Definition, examples and applications

In mathematics, the Onto function (also known as the Surjective function) is a function that maps every element in the range of the function to a corresponding element in the domain sets. Conversely, for every output value in the range, there is at least one input value in the domain that is mapped to that output value.

Formally, a function f: X → Y is said to be Onto if for every y ∈ Y, there exists an x ∈ X such that f(x) = y. Here, X is the domain of the function, and Y is the co-domain (the sets of all possible output values).

### To understand this concept better, let's consider an example.

Let f(x) = x² be a function that maps the real numbers to the non-negative real numbers. In this case, the domain is all real numbers, and the range is the set of non-negative real numbers.

Now, we can see that this function is not Onto because some non-negative real numbers (e.g., -1) are not the square of any real number. Therefore, there is no real number in the domain that maps to -1

On the other hand, let g(x) = 2x be a function that maps the real numbers to the real numbers. In this case, the function is Onto because, for every real number y, there exists a real number x such that g(x) = y. specifically, we can take x = y/2, and then g(x) = 2(x) = y.

## Let me explain Onto function in other way for better understanding:

A function f: A -> B is called an Onto function if the range of f is B. In other words, if each b ∈ B there exists at least one a ∈ A such that.
f(a) = b, then f is an on-to function. An Onto function is also called Surjective function.

Let A = {a1, a2, a3} and B = {b1, b2 } then f : A -> B

### Examples of Onto function

Example 1: Let A = {1, 2, 3}, B = {4, 5} and let f = {(1, 4), (2, 5), (3, 5)}. Show that f is an Surjective function from A into B.
Solution: Domain = {1, 2, 3} = A
Range = {4, 5}
The element from A, 2 and 3 has same range 5.
So f : A -> B is an Onto function.

Example 2: State whether the given function is on-to or not. f : R -> R defined by f(x) = 1 + x²
Solution: f(x) = 1 + x²
Let x = 1
f(1) = 1 + 1²
f(1) = 1 + 1
f(1) = 2 ----(equation 1)
Now, let x = -1
f(-1) = 1+ (-1)²
= 1 + 1
f(-1) = 2 -----(equation 2)
but 1 ≠ -1
∴ f is not one to one function.
If f is Onto then O ∈ R
f(x) = 0
∴ 1 + x² = 0
∴ x² = -1
x = ± √-1
but x ∈ R
∴ f is not on-to function

Example 3: Determine which of the following functions f :R->R are Onto i f(x) = x + 1
Solution: f(x) = x + 1
x = 1 ; f(x) = 1 + 1
f(1) = 2
x = -1 ; f(-1) = -1 + 1
f(-1) = 0
x = 0; f(x) = x + 1
f(0) = 0 + 1
f(0) = 1
From the above we can see that domain = {-1, 0, 1} and
range = {2, 0, 1}
So, the given function is on-to.

ii) f(x) = |x| + x
Solution: f(x) = |x| + x
For x = 0 ; f(0) = 0
For x = -1; f(-1) = |-1| + 1
= 1 + 1
f(-1) = 2
for x = 1; f(1) = |1| + 1
= 1 + 1
f(1) = 2
Domain = {0, -1, 1.}
Range = {0, 2, 2. }
So, the given function is not on-to.

### Here are some more examples of Onto functions:

The function f(x) = x² from the sets of real numbers to the non-negative real numbers is not Onto, because there is no real number whose square is negative. However, if we restrict the domain of f to the non-negative real numbers, then f becomes Onto.

The function f(x) = 2x from the sets of real numbers to the set of real numbers is Onto, because for any real number y, we can find a real number x such that f(x) = y, namely x = y/2.

The function f(x) = sin(x) from the sets of real numbers to the interval [-1,1] is Onto, because every real number in the interval [-1,1] is the sine of some real number.

The function f(x) = e^x from the sets of real numbers to the set of positive real numbers is Onto because, for any positive real number y, we can find a real number x such that f(x) = y, namely x = ln(y).

The function f(x) = x³ from the set of real numbers to the sets of real numbers is Onto because for any real number y, we can find a real number x such that f(x) = y, namely x = the cube root of y.

Each of these examples shows that every element in the codomain is mapped to at least one element in the domain. This is the defining characteristic of an Onto function.

### Here are a few examples of Onto functions:

The exponential function: The exponential function f(x) = e^x maps the set of all real numbers to the set of all positive real numbers. Since every positive real number can be written as e^x for some real number x, the exponential function is Onto.

The absolute value function: The absolute value function f(x) = |x| maps the set of all real numbers to the set of non-negative real numbers. Since every non-negative real number can be written as the absolute value of some real number (i.e., f(x) = |x| for x ≥ 0), the absolute value function is Onto.

The identity function: The identity function f(x) = x maps any set to itself. Since every element in the range of the function is also an element in the domain, the identity function is always Onto.

The inverse function: The inverse function of a bijective function (a function that is both one-to-one and Onto) is always an Onto function. For example, if f(x) = 2x is a bijective function that maps the set of real numbers to itself, then its inverse function f^-1(x) = x/2 is an Onto function that also maps the set of real numbers to itself.

The modulo function: The modulo function f(x) = x mod n maps the set of integers to the set of integers {0, 1, 2, ..., n-1} for any positive integer n. Since every integer between 0 and n-1 is in the range of the function, the modulo function is Onto.

In summary, an Onto function is a function that covers every element in the codomain. These examples illustrate different types of functions that can be Onto, including exponential functions, absolute value functions, and inverse functions of bijective functions.

### Significance of Onto function:

The concept of an Onto function (also known as a Surjective function) is significant in mathematics for several reasons. Here are some examples:

Injective/Surjective/Bijective functions: The notion of Onto functions is essential in understanding the concepts of injective, Surjective, and Bijective functions. A function is said to be injective if every element in the domain maps to a unique element in the co-domain. A function is bijective if it is both injective and Surjective. A function is Surjective if every element in the codomain is mapped to by at least one element in the domain.

Inverse functions: The concept of an Onto function is also important in understanding inverse functions. A function f: X → Y has an inverse function g: Y → X if and only if f is bijective. The inverse function g maps every element in the codomain back to a unique element in the domain.

Topology: In topology, an Onto function is called a quotient map. Quotient maps are used to define topological spaces by identifying points in space. For example, the Mobius strip can be defined as the quotient space of a rectangle by identifying two of its sides with a twist.

Abstract Algebra: Onto functions play an important role in abstract algebra, where they are used to define homomorphisms and isomorphisms. A homomorphism is a function that preserves the structure of a mathematical object (such as a group, ring, or vector space). An isomorphism is a bijective homomorphism.

For example, let f: R → R be defined by f(x) = x^3. This function is Onto because, for every y in the codomain R, there exists an x in the domain R such that f(x) = y. Therefore, f is a Surjective function.

On the other hand, let g: R → R be defined by g(x) = x^2. This function is not Onto because there exist negative numbers in the codomain R that are not mapped to by any element in the domain R. Therefore, g is not a Surjective function.

In summary, the concept of an Onto function is important in understanding many mathematical concepts and is used in various branches of mathematics such as calculus, topology, and abstract algebra.

## Practical application of Onto function

One practical application of Onto functions is in data compression algorithms. Data compression aims to reduce the size of a file or data set while retaining as much information as possible. One approach to data compression is to use an Onto function to map the original data to a smaller set of values.

For example, consider a data set that consists of a long sequence of integers. Suppose that the integers in the data set are all between 0 and 999 and that the data set is very large (e.g., several gigabytes). One way to compress this data set is to use an Onto function to map each integer to a smaller set of values. One such function might be the modulo function, which maps each integer to its remainder when divided by some fixed value (e.g., 100).

To illustrate how this works, suppose we use the modulo function with a fixed value of 100 to compress our data set. The function maps each integer in the data set to a value between 0 and 99. Since there are only 100 possible values in the range of the function, the compressed data set will be much smaller than the original data set.

Of course, there is a trade-off between the size of the compressed data set and the amount of information that is lost in the compression process. In our example, the compression function maps many different integers to the same value, so some information is lost. However, if the original data sets has certain patterns or regularities, the compression function may be able to preserve much of the information while still reducing the size of the data sets.

Another example of the use of Onto functions in practical applications is in cryptography. One popular encryption method called RSA (named after its inventors, Rivest, Shamir, and Adleman) uses an Onto function to encode and decode messages. In RSA, the Onto function is used to map each letter in the message to a large integer, which is then encrypted using a public key. The encrypted message can only be decrypted using the private key, which involves inverting the Onto function. This ensures that the message is secure even if it is intercepted by an attacker.

One practical application of Onto functions is in cryptography, specifically in public-key cryptography. Public-key cryptography relies on the existence of Onto functions to securely transmit messages between two parties.

In public-key cryptography, each user has a public and private key. The public key is used to encrypt messages, while the private key is used to decrypt messages. The security of the system relies on the difficulty of computing the private key from the public key.

One popular public-key cryptography algorithm is the RSA algorithm, named after its inventors Rivest, Shamir, and Adleman. The RSA algorithm relies on the properties of Onto functions to ensure the security of the system.

The RSA algorithm works as follows:

Choose two large prime numbers p and q.

Compute n = p * q, which is used as the modulus for the encryption and decryption operations.

Choose an integer e such that 1 < e < (p-1)(q-1) and e is coprime with (p-1)(q-1). The integer e is the public key.

Compute d such that de ≡ 1 (mod (p-1)(q-1)). The integer d is the private key.

To encrypt a message M, the sender computes C ≡ M^e (mod n) and sends C to the receiver.

The receiver computes M ≡ C^d (mod n) to decrypt the message.

The security of the RSA algorithm relies on the difficulty of computing d from e and n. This is equivalent to finding the inverse of e modulo (p-1)*(q-1), which is a computationally difficult problem known as the RSA problem.

The function used in the RSA algorithm is an Onto function, specifically the function f(x) = x^e (mod n). This function maps the set of all integers to the set of integers between 0 and n-1. Since every integer between 0 and n-1 is in the range of the function, the function is Onto.

In summary, Onto functions have practical applications in data compression, and cryptography, specifically in public-key cryptography algorithms such as RSA. The security of these systems relies on the difficulty of computing the private key from the public key, which in turn relies on the properties of Onto functions.

### Onto functions are important in mathematics for several reasons:

They are useful in proving theorems: Onto functions are often used in mathematical proofs to establish the existence of certain elements in a set. For example, if f: A → B is an Onto function and b is an element of B, then there exists an element an in A such that f(a) = b. This fact can be used to prove many theorems in mathematics.

They allow for the study of functions in general: Onto functions is a fundamental concept in the study of functions. Understanding the properties of Onto functions, such as their inverse functions, can help us understand more complex functions and their behavior.

They have practical applications: Onto functions have many practical applications, including in computer science, cryptography, and engineering. For example, the RSA encryption algorithm, which relies on the existence of Onto functions, is widely used for secure communication over the internet.

They help us understand the relationship between sets: Onto functions provide a way to understand the relationship between two sets. If there exists an Onto function between two sets, then we know that there is a one-to-one correspondence between the elements of the sets. This can be a powerful tool for understanding the structure of sets and their elements.

In summary, Onto functions are important in mathematics because they allow us to prove theorems, study functions, have practical applications, and understand the relationship between sets.

### There are several topics related to Onto functions. Here are a few examples with explanation:

Surjective function: A Surjective function, also known as an Onto function, is a function where every element in the range has a corresponding element in the domain that maps to it. In other words, every output value is mapped to by at least one input value. For example, the function f(x) = x^2 is not an Onto function because there are some non-negative numbers that are not the output of any input, such as -1. However, the function g(x) = e^x is an Onto function because every positive number has a corresponding input value that maps to it.

Inverse function: An inverse function is a function that reverses the input and output of another function. For a function to have an inverse function, it must be both one-to-one and Onto. For example, the function f(x) = x^3 is one-to-one but not Onto, so it does not have an inverse function. However, the function g(x) = sqrt(x) is both one-to-one and Onto, so it has an inverse function, which is f(x) = x^2.

Bijective function: A bijective function is a function that is both one-to-one and Onto. In other words, every output value is mapped to by exactly one input value, and every output value has a corresponding input value. For example, the function f(x) = x + 2 is a bijective function because every input value maps to a unique output value, and every output value has a corresponding input value.

Composition of functions: The composition of two functions is a new function that is formed by applying one function to the output of another function. The composition of two Onto functions is also an Onto function. For example, if f(x) = 2x and g(x) = x^2 are both Onto functions, then the composition function h(x) = f(g(x)) = 2x^2 is also an Onto function.

Range of a function: The range of a function is the set of all possible output values. For an Onto function, the range is equal to the entire codomain. For example, the function f(x) = x^2 has a domain of all real numbers and a codomain of all non-negative real numbers. However, its range is only the non-negative real numbers because it is not an Onto function.

Overall, Onto functions are important in many areas of mathematics and engineering, where it is important to ensure that every output value has a corresponding input value. These related topics help to understand the behaviour and properties of Onto functions and how they can be used to model and analyze various phenomena in the real world.