onto-functions

Mon Jun 29 2026

Onto (surjective) A function f:ABf: A \to B is onto if for every yBy \in B there exists at least one xAx \in A with f(x)=yf(x) = y. Every target in the codomain gets hit, so the range fills BB completely with no unreachable outputs.

The whole question onto answers is simple: can every output be produced? Pick any yy you like in the codomain, and onto promises some input maps to it. Geometrically, for f:RRf: \mathbb{R} \to \mathbb{R}, the graph has to touch every height on the y-axis. No gaps, no unreachable yy.

Proving onto: run the definition backwards

The definition reads "for every yy, there exists an xx", so the proof always has the same four moves. Start with an arbitrary yBy \in B. Solve f(x)=yf(x) = y for xx in terms of yy. Check that this xx actually lands in the domain AA. Then plug it back and confirm f(x)f(x) really simplifies to yy.

For f(x)=2x3f(x) = 2x - 3 on RR\mathbb{R} \to \mathbb{R}, the candidate input is x=(y+3)/2x = (y+3)/2, which is real for any real yy, and substituting it back gives yy. That is the recipe in full: find the preimage, check it lives in the domain, verify it maps where you want.

Not-onto, and what it does not mean

The cheapest not-onto function is f(x)=1f(x) = 1 on RR\mathbb{R} \to \mathbb{R}. Every input is used, but the output is just {1}\{1\}, so the rest of R\mathbb{R} is never reached. The function f(x)=x2f(x) = x^2 misses every negative number the same way. Both are perfectly valid functions, they just fail to cover their codomain.

Outputs may have gaps, inputs never can I first read "not onto" as the function being allowed to skip some inputs, leaving part of the domain unused. That mixes up the two sides. A function is total by definition: every element of its stated domain must map somewhere. If a rule is undefined at a point, that point is not in the domain (1/x1/x has domain R{0}\mathbb{R} \setminus \{0\}, not R\mathbb{R}). Onto is about the other side, whether the outputs cover BB. Outputs are free to leave gaps, which is exactly what not-onto means. Inputs are not.

onto-vs-not-onto-mapping

Why onto is worth proving

Two reasons. First, guaranteed solvability. Onto is an existence theorem in disguise: if ff is onto, the equation f(x)=yf(x) = y has a solution for every yy. In linear algebra, a transformation T:RnRmT: \mathbb{R}^n \to \mathbb{R}^m being onto is exactly the statement that Ax=bAx = b is solvable for every bb.

Second, onto is half of what you need for an inverse. To build f1:BAf^{-1}: B \to A, the inverse has to be defined on all of BB, because a function is total on its domain. If ff is not onto, some yBy \in B has no preimage, so f1f^{-1} has nothing to send it to and fails to be a function.

Onto is only half of an inverse

Onto gives every yy at least one preimage. For an inverse you also need at most one, which is the one-to-one (injective) condition: no output is shared by two inputs, or f1f^{-1} would have to send one yy to two places and stop being deterministic. Onto plus one-to-one is bijective, exactly one preimage per yy, and that is when f1f^{-1} exists. The one-to-one side, and the trap that catches most people proving it, is its own story in one-to-one-proof-converse-trap.

Equal sizes collapse onto and one-to-one

When the domain and codomain are finite and the same size, A=B=n|A| = |B| = n, onto and one-to-one stop being separate properties. Prove one and the other comes free. The reason is the Pigeonhole Principle: if ff is not one-to-one, two inputs collide on one output, so the nn inputs cover at most n1n-1 outputs, leaving some element of BB unreached, which is not onto. Run it the other way and not-onto forces not one-to-one.

Infinite sets break this. Take f:NNf: \mathbb{N} \to \mathbb{N} with f(1)=1f(1) = 1 and f(n)=n1f(n) = n - 1 for n>1n > 1. It is not one-to-one, since 11 and 22 both map to 11, yet it is onto, since every yy has preimage y+1y + 1. The bound that locked the two properties together is gone. This asymmetry is the very definition of an infinite set: a set is infinite exactly when it has a map to itself that is onto but not one-to-one (a Dedekind-infinite set).

The handle Onto is a claim about the output side: every target in BB gets hit. Inputs are never allowed gaps, that is what makes ff a function. Outputs are allowed gaps, that is what makes a function not-onto, and onto closes that gap. Add one-to-one and the inverse appears. For equal finite sizes the two properties come as a pair, for infinite sets they part ways.