Surjective Functions
Can every element of a target set be reached by some function? This is the question of surjectivity. It is one of two ways a function can "fill up" its output space. Consider the function that assigns to each person their birth year. Does every year in recorded history actually appear as someone's birth year? Suppose the codomain is "all years since 1900." If the function's image misses, say, 1901, the function is not surjective onto that codomain. This happens if no one currently alive was born then. Even so, it remains a perfectly good function. This distinction matters enormously. Surjectivity is not an intrinsic property of a function's rule alone. It is a relationship between the function and a declared codomain. Two functions can have identical rules but different declared codomains. Such functions can differ in surjectivity. This subtlety trips up many students the first time they meet it. Understanding surjections precisely is the gateway to several key ideas. It helps in comparing the "sizes" of infinite sets. It aids in constructing inverse functions. It also underlies core arguments in analysis, algebra, and computer science. It matters anywhere one needs to know that every target is actually hit. The big picture: a function packages three pieces of data. These are a domain , a codomain , and a rule of assignment. Injectivity asks whether the rule ever collapses distinct inputs together. Surjectivity asks the complementary question. Does the rule's output sweep out the entire codomain? Or does it leave some of untouched? Together, injectivity and surjectivity combine into bijectivity. This is the notion of a "perfect matching" between two sets. It underlies the entire theory of Comparing Cardinalities. This article gives the precise definition of a surjective function. It develops the standard proof technique for establishing surjectivity. This is the "codomain-chasing" argument. It proves a key structural theorem relating surjections to right inverses. It also works through fully rigorous examples. One example is designed to expose the single most common student error.
- A function is surjective (onto) if every element of is the image of some element of .
- Surjectivity depends on the codomain , not just on the formula defining — change and surjectivity can change.
- The standard proof method: fix an arbitrary , then construct (or prove existence of) an with .
- is surjective if and only if its range equals its codomain: .
- Surjectivity is equivalent (assuming the Axiom of Choice for the converse direction) to the existence of a right inverse with .
- Key idea: surjectivity is a statement about the codomain being fully covered, proved by showing every target has a preimage.
Where this lives today
Surjectivity is a load-bearing concept far beyond pure set theory. In Comparing Cardinalities, the existence of a surjection (with nonempty) is used to show , dual to how injections show — the Cantor–Schröder–Bernstein circle of ideas depends on both notions working together. In the theory of Bijections and Inverse Functions, surjectivity is exactly half of what is needed for a function to admit a genuine two-sided inverse: a function has an inverse function precisely when it is both injective and surjective. In linear algebra, a linear map between vector spaces is surjective exactly when its image equals all of , which by the rank–nullity theorem constrains dimensions: if then no linear map can be surjective. In group theory, surjective homomorphisms (epimorphisms) let one identify with a quotient via the First Isomorphism Theorem — surjectivity is precisely what guarantees no part of is left outside the image. In real analysis, the Intermediate Value Theorem is essentially a surjectivity statement: a continuous function on an interval that takes values and hits every value in between, making it surjective onto that sub-interval. In cryptography, hash functions are deliberately designed to be far from surjective onto their full theoretical output space in a controlled way, and the study of collision resistance is closely tied to failures of injectivity while surjectivity-like "coverage" properties matter for uniform output distribution. In computer science and databases, a surjective mapping from records to keys ensures no key-space value is "wasted" or unreachable, relevant to hashing schemes and enumerations. In statistics, surjective parameter maps in statistical models ensure that the full range of a statistic is achievable, which matters for identifiability and for constructing confidence procedures that cover the entire parameter space.
Ask the tutor: Can you show me why a surjection between finite sets of equal size is automatically injective, using the pigeonhole principle?
Let and be sets and let be a function (as a special kind of relation, per Functions as Special Relations). We say is surjective, or onto , or a surjection, if
Equivalently, is surjective if and only if its range,
satisfies . Since always holds for a function into , surjectivity is exactly the assertion of the reverse inclusion . When is not surjective, its negation is:
that is, some element of is missed entirely by ; such a is called a point outside the image, or informally a "gap" in the codomain.
Intuition
Picture a function as an arrow diagram: dots on the left representing the domain , dots on the right representing the codomain , and an arrow from each to its image . Surjectivity says that every dot on the right has at least one arrow pointing into it. It says nothing about how many arrows land on each dot — some elements of might receive two, three, or infinitely many arrows. All that matters is that no dot on the right is left unvisited. This is why surjectivity is fundamentally a statement about coverage, not about counting or matching one-to-one. It is the "dual" notion to injectivity, which forbids two arrows from the left landing on the same dot. A function can be surjective without being injective (many arrows piling onto one dot is fine, as long as every dot gets at least one), and it can be injective without being surjective (each dot gets at most one arrow, but some dots on the right may get none).
The second picture below shows the same rule, on real numbers, behaving differently depending on the declared codomain — the crux of why codomain-checking is the whole game.
The central theorem
Let and be sets and a function. Then:
Moreover, if , then is surjective if and only if there exists a function such that
where is the identity function on . Such a is called a right inverse of .
We prove the two claims in turn.
Part 1: is surjective . This is essentially definitional, but we spell out both inclusions since they hide different logical content. By the definition of a function , every output for lies in ; this is precisely what it means for to be a function into . Hence
always holds, regardless of surjectivity. This gives one inclusion unconditionally. () Suppose is surjective. Let be arbitrary. By the definition of surjectivity, there exists with . Hence . Since was arbitrary, . Combined with the unconditional inclusion above, . () Suppose . Let be arbitrary. Since , we have , which means precisely that there exists with . Since was arbitrary, this establishes , i.e., is surjective. This completes Part 1, by direct proof of both directions of the biconditional.
Part 2: (assuming ) is surjective there is a right inverse with . () Suppose such a exists with . Let be arbitrary. Set (this is a legitimate element of since is a function from to ). Then
Thus satisfies . Since was arbitrary, is surjective. This direction required no special axioms — it is a direct construction. () Suppose is surjective and . We construct as follows. For each , by surjectivity the set
is nonempty (it is the "preimage fiber" over ). We must choose, for each , one element of this nonempty set, to define . If is finite, or more generally if we can specify a definite selection rule (e.g. and we always pick the least element of each fiber by the well-ordering of ), this selection can be done explicitly. In general, when no such canonical rule is available, we invoke the Axiom of Choice: since is an indexed family of nonempty sets, there exists a choice function
By construction, for every , i.e. . This establishes the existence of a right inverse. (Note: the hypothesis is needed only to guarantee can have nonempty domain-compatible fibers to choose from in degenerate cases; if then is surjective only when too, and the statement is handled trivially by taking to be the empty function.) Both directions are established, completing Part 2.
∎The technique used in the forward direction of Part 1, and throughout surjectivity proofs generally, is called codomain-chasing: fix an arbitrary target element, and either exhibit an explicit domain element mapping to it, or prove one must exist.
Worked examples
Example 1 — an explicit, asymmetric algebraic surjection. Let be defined by
Claim: is surjective. Proof. Let be arbitrary; we must find with . Solve the equation directly:
Since the real cube root function is defined for every real number (unlike the square root, cube root has no domain restriction, because odd-degree real polynomials are surjective by the Intermediate Value Theorem applied to , which is unbounded above and below and continuous), the expression is a well-defined real number for every real . We verify this actually works: substituting back,
So exactly, as required. Since was arbitrary, is surjective. Note how this differs from injectivity proofs: here we did not merely manipulate an equation — we solved for in terms of and verified the solution lies in the domain. This constructive solving is the hallmark of a surjectivity proof when an explicit inverse formula is available.
Example 2 — a surjection that is not injective, checked via range computation. Let and let . Define by . Claim: is well-defined and surjective, but not injective. Well-definedness check. We must confirm for every :
Every one of these values, , lies in , so is indeed a function from into . Surjectivity check. We compute the range directly and compare to :
By Range–Codomain Characterization of Surjectivity (Part 1 above), since , the function is surjective. Concretely, exhibiting a preimage for each element of : , , , . Failure of injectivity. Note but , so is not injective. This confirms surjectivity is logically independent of injectivity: this has every codomain element hit (some multiple times) without being one-to-one. A cautionary variant. Now consider the same rule but with enlarged codomain . Recomputing, is still (since has not changed), but now . So with the identical rule is not surjective — the value has no preimage in . This illustrates precisely why the codomain must be checked, not just the formula.
The theorem and its proof rely on treating , the codomain, as a fixed, declared part of the function's data. Suppose instead someone tries to argue "surjectivity" by looking only at the formula for and an informally guessed target set, without pinning down precisely. Here is the failure this causes. Let be defined by . A careless argument: "For any integer I want to hit, I can take , so is surjective." This argument is wrong, and the error is a hidden, unstated restriction that was never verified: is only an integer when is even. If , then , so there is no with . Indeed,
the even integers, which is a proper subset of (it excludes all odd integers). Since , by Range–Codomain Characterization of Surjectivity this is not surjective. What went wrong, precisely: the "proof" implicitly solved the equation over the rationals () but never checked that the solution lands back inside the declared domain , and by extension never confirmed every target in the declared codomain is actually reachable. This is exactly the hypothesis that must not be dropped: a surjectivity proof must verify the constructed preimage lies in for every element of the actual codomain , not merely for a convenient subset of , and not over some larger ambient set like . Contrast this with the same rule reinterpreted as , . Here, for any , we have (since is closed under division by nonzero rationals), so . This version genuinely is surjective. The formula "" is identical; only the domain and codomain changed, and that change alone flips surjectivity from false to true. This is the sharpest possible illustration that surjectivity is a property of the triple , not of the rule in isolation.
Scope, edge cases & common traps
| Situation | What to check | Common pitfall |
|---|---|---|
| , | The empty function is (vacuously) surjective | Thinking "no elements to map" means automatically not surjective — it's vacuously true |
| , | No function can be surjective if has an element | Forgetting the empty domain case entirely |
| finite, finite, | cannot be surjective (pigeonhole, contrapositive form) | Trying to force a surjectivity proof when a quick cardinality check refutes it |
| , both infinite | Surjectivity does not follow from " looks bigger"; must construct preimages | Assuming intuition from finite sets transfers directly to infinite sets |
| Codomain enlarged after defining rule | Re-verify for the new | Believing surjectivity is preserved automatically when codomain changes |
| Composition surjective | Does not imply is surjective; does imply is surjective | Misattributing the surjectivity to the wrong factor of the composition |
The mathematician behind it
Origins · 1 minNicolas Bourbaki (collective pseudonym) & Richard Dedekind and how this was discovered
The modern language of "surjection," "injection," and "bijection" as a systematic trio was popularized in the 20th century by the Bourbaki group, a collective of (mostly French) mathematicians who rebuilt mathematics from set-theoretic foundations starting in the 1930s. But the conceptual content — a function as a rule together with a specified codomain, and the question of whether that codomain is fully covered — traces to the foundational work of Richard Dedekind, who in the 1880s gave some of the first rigorous treatments of mappings between sets in his work on the foundations of arithmetic and on chains (what we now call closure under a function). Dedekind's insistence on treating a function as data including its target set, not merely its graph of pairs, is precisely the discipline this article's counterexample depends on.
Is every bijection automatically a surjection?
Yes. A bijection is defined as a function that is both injective and surjective simultaneously, so surjectivity is literally one of the two defining conditions of a bijection. This is why, when proving a function is a bijection, standard practice is to prove injectivity and surjectivity as two entirely separate arguments and then simply conjoin them. See Bijections and Inverse Functions for how this combination yields a genuine two-sided inverse function, unlike a surjection alone, which (per this article's theorem) only guarantees a one-sided right inverse in general, and typically requires the Axiom of Choice to construct.
Does surjectivity depend on the domain, the codomain, or both?
It depends on both, but asymmetrically. Shrinking the domain can destroy surjectivity (fewer inputs may mean fewer outputs are reached), while enlarging the domain can only help or maintain surjectivity, never hurt it, since the range can only grow or stay the same. Enlarging the codomain can destroy surjectivity (new unreached targets appear), while shrinking the codomain to exactly the range preserves or restores it. The precise criterion, proven above, is — so it is really a comparison between the range (determined by and the rule) and the codomain as declared.
Can a function from an infinite set to itself fail to be surjective, even though both sets are "the same size"?
Yes, and this is one of the most important phenomena distinguishing infinite from finite sets. For finite sets, a function is surjective if and only if it is injective (both are equivalent to being a bijection, since forces a tight pigeonhole argument). For infinite sets this equivalence fails. Consider given by : this is injective but not surjective, since has no preimage. This asymmetry between finite and infinite behavior is one of the deep points developed further in Comparing Cardinalities.
Why does the reverse direction of the right-inverse theorem need the Axiom of Choice?
Because proving a surjection has a right inverse requires simultaneously selecting one preimage from each of possibly infinitely many nonempty fibers , for every in a possibly infinite (even uncountable) codomain , with no canonical or explicit rule for making all these choices at once. When such a canonical rule exists — for instance, if , one can always choose the least element of each fiber using the well-ordering of — no appeal to the Axiom of Choice is needed. But for an arbitrary surjection between arbitrary sets, the Axiom of Choice is, in general, genuinely necessary (this is a known independence result in set theory) to guarantee the choice function exists.
Is checking literally the same task as proving surjectivity directly from the definition?
Yes, they are logically equivalent tasks, proven equivalent in this article's theorem, but they often feel different in practice. Proving surjectivity directly means fixing an arbitrary and producing (or proving existence of) some with — a "chase forward from the target" argument. Computing explicitly and comparing it to works well when and are small or finite, as in Example 2. For infinite or algebraically defined domains, the direct method (solving for ) is usually more tractable, as in Example 1.
How does surjectivity interact with function composition in general?
If and are both surjective, then is surjective: given , surjectivity of gives with , and surjectivity of gives with , so . Conversely, if is surjective, one can prove must be surjective (given , take with , then satisfies ), but need not be surjective — see the quiz above for a worked instance of this asymmetry.
Is "onto" a different concept from "surjective," or just different terminology?
Purely different terminology for an identical concept. "Onto" is the older, more descriptive English phrase — the function maps "onto" all of , as opposed to merely "into" (hitting only part of it). "Surjective," from the French "sur" (onto) plus "-jective," was introduced by the Bourbaki collective as the standardized term used across nearly all modern textbooks and research literature. Some texts use "onto" as an adjective phrase (" maps onto ") and "surjective" as a plain adjective (" is surjective"), but the mathematical content is word-for-word identical.