Onto Function
An onto function (also called a surjective function or a surjection) is a function in which the codomain is equal to the range—that is, every element of the codomain is the image of at least one element of the domain.
Formally, given a function \(f\) with domain \(D_f\) and codomain \(C_f\), \(f\) is said to be onto (or surjective) if:
$$\forall y \in C_f, \ \exists x \in D_f: y = f(x)$$
This expression means that no matter which element \(y\) we choose from the codomain, there will always exist at least one value \(x\) in the domain such that \(f(x) = y\). If there is even a single element in the codomain that does not belong to the range, then it is a non-onto function.
It is important not to confuse surjectivity with the existence condition required for every function. For a relation to be a function, every element of the domain must have an image in the codomain; by contrast, for it to also be onto, no element of the codomain can be left without a preimage in the domain.
An everyday situation that illustrates this property is mail delivery in a neighborhood: suppose the domain is the group of mail carriers on duty and the codomain is the set of houses scheduled to receive mail. The assignment is onto if no house goes without receiving its mail, even if two different carriers deliver to the same address at different times.
Table of Contents
How to Tell If a Function Is Onto
To determine whether a function is onto, we find its range and verify that it matches its codomain exactly (\(R_f = C_f\)). If both sets are different, the function is not onto.
In the study of real-valued functions of a real variable, when the codomain is not specified, it is assumed by convention to be the entire set of real numbers (\(C_f = \mathbb{R}\)). In such cases, checking whether a function is onto is equivalent to showing that the range covers all of \(\mathbb{R}\).
Unlike being one-to-one, being onto does not depend solely on the formula of the function, but also on how its codomain is defined. The same expression can fail to be onto as \(f: \mathbb{R} \to \mathbb{R}\) and become onto if defined as \(f: \mathbb{R} \to [0, +\infty)\), as happens with \(f(x) = x^2\).
Unlike injectivity (where applying the horizontal line test is enough), there is no automatic visual or algebraic test for surjectivity without knowing the codomain beforehand. Graphically, every horizontal line drawn at the height of each element in \(C_f\) must intersect the curve at least once; algebraically, the standard procedure consists of solving for \(x\) in terms of \(y\) to identify which values of \(y\) admit a real preimage.
Example 1
Determine whether the absolute value function \(f(x) = |x|\) is onto.
Since the problem statement does not specify the target set, we assume the codomain is \(C_f = \mathbb{R}\). To find the range, we analyze the values that \(y = |x|\) can take: by definition, the absolute value of any real number is always greater than or equal to zero, which implies that \(y \geq 0\).
Consequently, the range of the function is the interval \(R_f = [0, +\infty)\). Comparing both sets, we see that \(R_f \neq C_f\), because negative real numbers are not the image of any element in the domain. Therefore, the absolute value function is not onto.
Example 2
Analyze whether the function \(f: [0, +\infty) \to [0, +\infty)\) defined by \(f(x) = \sqrt{x}\) is onto.
In this case, the notation explicitly gives us both the domain \(D_f = [0, +\infty)\) and the codomain \(C_f = [0, +\infty)\). To check whether every element \(y \in C_f\) has a preimage, we set up the equation \(y = \sqrt{x}\) and solve for \(x\):
$$x = y^2$$
Since any real number \(y \geq 0\) squared produces a number \(x \geq 0\) that belongs to the domain \(D_f\), every element of the codomain has at least one preimage. Thus, the range is \(R_f = [0, +\infty) = C_f\), which confirms that the function is onto.
Example 3
Check whether the rational function \(f(x) = \dfrac{2x + 1}{x - 3}\) is onto.
Since no codomain is specified, we take \(C_f = \mathbb{R}\). To find the range using the algebraic method, we write \(y = \dfrac{2x + 1}{x - 3}\) and solve for the variable \(x\) in terms of \(y\):
$$y(x - 3) = 2x + 1$$
$$xy - 3y = 2x + 1$$
$$xy - 2x = 3y + 1$$
$$x(y - 2) = 3y + 1$$
$$x = \dfrac{3y + 1}{y - 2}$$
We observe that this expression is defined for every real number \(y\) except when the denominator equals zero—that is, when \(y - 2 = 0\), giving \(y = 2\). This means that \(y = 2\) has no preimage in the domain, so the range is \(R_f = \mathbb{R} \setminus \{2\}\). Since \(R_f \neq C_f\), we conclude that the function is not onto.
From a graphical standpoint, on the coordinate plane we can check whether a function is onto by projecting the entire curve onto the vertical \(y\)-axis. The function is onto if the projection covers the entire interval corresponding to the codomain \(C_f\) without breaks or gaps.
How to Make a Function Onto
Any non-onto function can be turned into an onto one through a codomain restriction. The procedure consists of discarding from the codomain all elements that do not have a preimage, redefining the new codomain so that it matches the range exactly (\(C_f = R_f\)).
This modification does not alter the formula of the function or its domain, only the set in which the output values are considered. Let us see how it is applied in two specific cases:
Example 1
Make the rational function \(f(x) = \dfrac{2x + 1}{x - 3}\) onto.
As we determined in the previous section, this function has domain \(D_f = \mathbb{R} \setminus \{3\}\) and range \(R_f = \mathbb{R} \setminus \{2\}\). When all of \(\mathbb{R}\) is taken as the codomain, the number \(2\) is left without a preimage.
To make the function onto, we restrict the codomain by removing that single excluded value from the range. Thus, we redefine the function as \(f: \mathbb{R} \setminus \{3\} \to \mathbb{R} \setminus \{2\}\), whereby \(C_f = R_f\) and the function becomes onto.
Example 2
Restrict the codomain of the quadratic function \(g(x) = x^2\) so that it becomes onto.
Considered from \(\mathbb{R}\) to \(\mathbb{R}\), the function \(g(x) = x^2\) is not onto because the square of any real number is always non-negative, which limits its range to the interval \(R_g = [0, +\infty)\).
If we replace the original codomain with its range, we obtain the function \(g: \mathbb{R} \to [0, +\infty)\) given by \(g(x) = x^2\). Under this new definition, every element in \([0, +\infty)\) is the image of at least one real number, making the function onto.
Importance of Surjectivity
Surjectivity becomes especially important when we want to construct the inverse function \(f^{-1}\). When inverting a function \(f: D_f \to C_f\), we swap the roles of the sets: the original codomain \(C_f\) becomes the domain of \(f^{-1}\), and the original domain \(D_f\) becomes its codomain.
For this inverse relation \(f^{-1}: C_f \to D_f\) to actually be a valid function, \(f\) must simultaneously satisfy two conditions:
- One-to-one (injective): each element of the range comes from a unique element of the domain, which guarantees that when reversing the arrows, each input has a single output (uniqueness).
- Onto (surjective): every element of the codomain belongs to the range, which ensures that when reversing the arrows, no element of the new domain is left without an image (existence).
- Bijective: satisfies both one-to-one and onto properties at the same time—a necessary and sufficient condition for \(f^{-1}\) to exist.
If a function is one-to-one but not onto, we cannot define its inverse starting from all of \(C_f\) without restricting it first, since the leftover elements of the original codomain would have no corresponding element in \(D_f\), violating the definition of a function.
Example 1
Find the inverse function of \(f(x) = \dfrac{2x + 1}{x - 3}\) after applying its codomain restriction.
This rational function is already one-to-one on its entire domain \(D_f = \mathbb{R} \setminus \{3\}\), since two distinct inputs never produce the same output. By restricting its codomain to \(C_f = \mathbb{R} \setminus \{2\}\), the function becomes bijective and admits an inverse.
Using the algebraic rearrangement we performed earlier and swapping the variables \(x\) and \(y\), we obtain the inverse function \(f^{-1}: \mathbb{R} \setminus \{2\} \to \mathbb{R} \setminus \{3\}\) defined by:
$$f^{-1}(x) = \dfrac{3x + 1}{x - 2}$$
Example 2
Analyze whether the function \(g: \mathbb{R} \to [0, +\infty)\) given by \(g(x) = x^2\) has an inverse.
Although in the previous section we restricted the codomain to \([0, +\infty)\) to make it onto, this function is still not one-to-one on \(\mathbb{R}\), since opposite values share the same image (for example, \(g(2) = 4\) and \(g(-2) = 4\)). If we tried to invert it as is, the number \(4\) would have two different images.
Therefore, in addition to restricting the codomain, we also need to restrict the domain to \([0, +\infty)\). In this way we achieve the bijection \(g: [0, +\infty) \to [0, +\infty)\), whose inverse function is \(g^{-1}: [0, +\infty) \to [0, +\infty)\) defined by \(g^{-1}(x) = \sqrt{x}\).
Examples of Onto and Non-Onto Functions
To quickly identify the behavior of elementary functions, we assume by default that they are defined on their maximal domain into the codomain \(C_f = \mathbb{R}\). The following table summarizes which ones are onto under this convention and what condition is required otherwise:
| Function Type | Is It Onto? | Example | Note or Condition |
|---|---|---|---|
| Linear (non-constant) | Yes | \(f(x) = 3x - 2\) | Its range is always \(\mathbb{R}\), covering the entire codomain. |
| Constant | No | \(f(x) = 5\) | Its range contains a single value; it is only onto if the codomain is restricted to that value. |
| Odd-degree polynomial | Yes | \(f(x) = 2x^3 + 5\) | Since it approaches \(−\infty\) and \(+\infty\) continuously, its range covers all of \(\mathbb{R}\). |
| Even-degree polynomial | No | \(f(x) = x^2 + 3\) | It has a global maximum or minimum; requires restricting Cf to its range. |
| Rational (fractional linear) | No | \(f(x) = \dfrac{1}{x}\) | It never reaches the value of its horizontal asymptote; achieved by removing that point from Cf. |
| Odd-index radical | Yes | \(f(x) = \sqrt[3]{x}\) | Its range is \(\mathbb{R}\), so it covers the entire codomain without restrictions. |
| Even-index radical | No | \(f(x) = \sqrt{x}\) | It only produces non-negative values; it is onto if Cf = [0, \(+\infty\)). |
| Exponential | No | \(f(x) = e^x\) | It is always positive (or negative if the coefficient is negative); requires Cf = (0, \(+\infty\)). |
| Logarithmic | Yes | \(f(x) = \ln(x)\) | Defined for x > 0, its range covers all real numbers. |
| Sine and cosine | No | \(f(x) = \cos(x)\) | They oscillate between −1 and 1; they are onto if Cf is restricted to the interval [−1, 1]. |
| Tangent | Yes | \(f(x) = \tan(x)\) | On its maximal domain, each branch takes on every value in \(\mathbb{R}\). |
In the case of piecewise-defined functions, being onto does not require each piece to cover the codomain separately, but rather that the union of the images of all pieces completes \(C_f\). If there is any vertical jump between pieces that leaves values of \(y\) uncovered within the codomain, the function will not be onto.
Onto but Not One-to-One Functions
Being onto and being one-to-one are independent properties: a function can cover its entire codomain while simultaneously repeating images for different input values. Considering the codomain \(C_f = \mathbb{R}\), the following cases illustrate functions that are onto but not one-to-one:
- \(f(x) = \tan(x)\): it is periodic and repeats every real value infinitely many times (for example, \(\tan(0) = 0\) and \(\tan(\pi) = 0\)), yet its range is all of \(\mathbb{R}\).
- \(f(x) = 3x^3 + 6x^2\): being a cubic, its range spans all of \(\mathbb{R}\), although it has a local maximum and a local minimum that cause certain values of \(y\) to have up to three distinct preimages.
- \(f(x) = x^5 + x^2\): because it has an odd degree, it covers the entire real line, but since it is not strictly increasing across its entire domain, different inputs yield the same output.
Did you find this useful? Rate it!
Leave a Reply



Related Articles