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 f:A→Bf : A \to B packages three pieces of data. These are a domain AA, a codomain BB, 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 BB 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.

Key takeaways
  • A function f:A→Bf : A \to B is surjective (onto) if every element of BB is the image of some element of AA.
  • Surjectivity depends on the codomain BB, not just on the formula defining ff — change BB and surjectivity can change.
  • The standard proof method: fix an arbitrary b∈Bb \in B, then construct (or prove existence of) an a∈Aa \in A with f(a)=bf(a) = b.
  • ff is surjective if and only if its range equals its codomain: ran⁡(f)=B\operatorname{ran}(f) = B.
  • Surjectivity is equivalent (assuming the Axiom of Choice for the converse direction) to the existence of a right inverse g:B→Ag : B \to A with f∘g=idBf \circ g = \mathrm{id}_B.
  • 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 f:A→Bf: A \to B (with AA nonempty) is used to show ∣B∣≤∣A∣|B| \leq |A|, dual to how injections show ∣A∣≤∣B∣|A| \leq |B| — 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 T:V→WT : V \to W between vector spaces is surjective exactly when its image equals all of WW, which by the rank–nullity theorem constrains dimensions: if dim⁡V<dim⁡W\dim V < \dim W then no linear map V→WV \to W can be surjective. In group theory, surjective homomorphisms (epimorphisms) φ:G→H\varphi : G \to H let one identify HH with a quotient G/ker⁡φG/\ker\varphi via the First Isomorphism Theorem — surjectivity is precisely what guarantees no part of HH 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 f(a)f(a) and f(b)f(b) 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?

DefinitionSurjective Function

Let AA and BB be sets and let f:A→Bf : A \to B be a function (as a special kind of relation, per Functions as Special Relations). We say ff is surjective, or onto BB, or a surjection, if

∀b∈B, ∃a∈A, f(a)=b.\forall b \in B,\ \exists a \in A,\ f(a) = b.

Equivalently, ff is surjective if and only if its range,

ran⁡(f)={ f(a):a∈A }={ b∈B:∃a∈A, f(a)=b },\operatorname{ran}(f) = \{\, f(a) : a \in A \,\} = \{\, b \in B : \exists a \in A,\ f(a) = b \,\},

satisfies ran⁡(f)=B\operatorname{ran}(f) = B. Since ran⁡(f)⊆B\operatorname{ran}(f) \subseteq B always holds for a function into BB, surjectivity is exactly the assertion of the reverse inclusion B⊆ran⁡(f)B \subseteq \operatorname{ran}(f). When ff is not surjective, its negation is:

∃b∈B, ∀a∈A, f(a)≠b,\exists b \in B,\ \forall a \in A,\ f(a) \neq b,

that is, some element of BB is missed entirely by ff; such a bb 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 AA, dots on the right representing the codomain BB, and an arrow from each a∈Aa \in A to its image f(a)∈Bf(a) \in B. 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 BB 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).

Figure
Arrow diagram: a surjective function from a 4-element domain onto a 3-element codomain
A (domain) B (codomain) a₁ a₂ a₃ a₄ b₁ b₂ b₃ Every element of B (b₁, b₂, b₃) receives at least one arrow — the function is onto.

The second picture below shows the same rule, f(x)=x2f(x) = x^2 on real numbers, behaving differently depending on the declared codomain — the crux of why codomain-checking is the whole game.

Figure
Same rule, two codomains: surjective onto one target, not onto a larger one
ℝ (codomain, case 2) range = [0, ∞) covers case-1 codomain exactly 0 −4 (never hit) f(x) = x², f : ℝ → [0,∞) is surjective f(x) = x², f : ℝ → ℝ is NOT surjective (misses −4, and all negatives)

The central theorem

TheoremRange–Codomain Characterization of Surjectivity

Let AA and BB be sets and f:A→Bf : A \to B a function. Then:

f is surjective  ⟺  ran⁡(f)=B.f \text{ is surjective} \iff \operatorname{ran}(f) = B.

Moreover, if A≠∅A \neq \varnothing, then ff is surjective if and only if there exists a function g:B→Ag : B \to A such that

f∘g=idB,f \circ g = \mathrm{id}_B,

where idB\mathrm{id}_B is the identity function on BB. Such a gg is called a right inverse of ff.

Proof

We prove the two claims in turn.

Part 1: ff is surjective   ⟺  ran⁡(f)=B\iff \operatorname{ran}(f) = B. This is essentially definitional, but we spell out both inclusions since they hide different logical content. By the definition of a function f:A→Bf : A \to B, every output f(a)f(a) for a∈Aa \in A lies in BB; this is precisely what it means for ff to be a function into BB. Hence

ran⁡(f)={f(a):a∈A}⊆B\operatorname{ran}(f) = \{ f(a) : a \in A \} \subseteq B

always holds, regardless of surjectivity. This gives one inclusion unconditionally. (⇒\Rightarrow) Suppose ff is surjective. Let b∈Bb \in B be arbitrary. By the definition of surjectivity, there exists a∈Aa \in A with f(a)=bf(a) = b. Hence b∈ran⁡(f)b \in \operatorname{ran}(f). Since b∈Bb \in B was arbitrary, B⊆ran⁡(f)B \subseteq \operatorname{ran}(f). Combined with the unconditional inclusion above, ran⁡(f)=B\operatorname{ran}(f) = B. (⇐\Leftarrow) Suppose ran⁡(f)=B\operatorname{ran}(f) = B. Let b∈Bb \in B be arbitrary. Since B=ran⁡(f)={f(a):a∈A}B = \operatorname{ran}(f) = \{f(a) : a \in A\}, we have b∈{f(a):a∈A}b \in \{f(a) : a \in A\}, which means precisely that there exists a∈Aa \in A with f(a)=bf(a) = b. Since b∈Bb \in B was arbitrary, this establishes ∀b∈B ∃a∈A f(a)=b\forall b \in B\, \exists a \in A\, f(a) = b, i.e., ff is surjective. This completes Part 1, by direct proof of both directions of the biconditional.

Part 2: (assuming A≠∅A \neq \varnothing) ff is surjective   ⟺  \iff there is a right inverse g:B→Ag : B \to A with f∘g=idBf \circ g = \mathrm{id}_B. (⇐\Leftarrow) Suppose such a g:B→Ag : B \to A exists with f∘g=idBf \circ g = \mathrm{id}_B. Let b∈Bb \in B be arbitrary. Set a:=g(b)∈Aa := g(b) \in A (this is a legitimate element of AA since gg is a function from BB to AA). Then

f(a)=f(g(b))=(f∘g)(b)=idB(b)=b.f(a) = f(g(b)) = (f \circ g)(b) = \mathrm{id}_B(b) = b.

Thus a∈Aa \in A satisfies f(a)=bf(a) = b. Since bb was arbitrary, ff is surjective. This direction required no special axioms — it is a direct construction. (⇒\Rightarrow) Suppose ff is surjective and A≠∅A \neq \varnothing. We construct g:B→Ag : B \to A as follows. For each b∈Bb \in B, by surjectivity the set

f−1({b})={a∈A:f(a)=b}f^{-1}(\{b\}) = \{ a \in A : f(a) = b \}

is nonempty (it is the "preimage fiber" over bb). We must choose, for each b∈Bb \in B, one element of this nonempty set, to define g(b)g(b). If BB is finite, or more generally if we can specify a definite selection rule (e.g. A⊆NA \subseteq \mathbb{N} and we always pick the least element of each fiber by the well-ordering of N\mathbb{N}), this selection can be done explicitly. In general, when no such canonical rule is available, we invoke the Axiom of Choice: since {f−1({b}):b∈B}\{ f^{-1}(\{b\}) : b \in B \} is an indexed family of nonempty sets, there exists a choice function

g:B→A,g(b)∈f−1({b}) for every b∈B.g : B \to A, \qquad g(b) \in f^{-1}(\{b\}) \text{ for every } b \in B.

By construction, f(g(b))=bf(g(b)) = b for every b∈Bb \in B, i.e. f∘g=idBf \circ g = \mathrm{id}_B. This establishes the existence of a right inverse. (Note: the hypothesis A≠∅A \neq \varnothing is needed only to guarantee gg can have nonempty domain-compatible fibers to choose from in degenerate cases; if A=∅A = \varnothing then f:∅→Bf : \varnothing \to B is surjective only when B=∅B = \varnothing too, and the statement is handled trivially by taking gg to be the empty function.) Both directions are established, completing Part 2. ■\blacksquare

∎

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 f:R→Rf : \mathbb{R} \to \mathbb{R} be defined by

f(x)=5x3−2.f(x) = 5x^3 - 2.

Claim: ff is surjective. Proof. Let y∈Ry \in \mathbb{R} be arbitrary; we must find x∈Rx \in \mathbb{R} with f(x)=yf(x) = y. Solve the equation directly:

5x3−2=y  ⟺  x3=y+25  ⟺  x=y+253.5x^3 - 2 = y \iff x^3 = \frac{y+2}{5} \iff x = \sqrt[3]{\frac{y+2}{5}}.

Since the real cube root function t↦t3t \mapsto \sqrt[3]{t} is defined for every real number tt (unlike the square root, cube root has no domain restriction, because odd-degree real polynomials are surjective by the Intermediate Value Theorem applied to t3t^3, which is unbounded above and below and continuous), the expression x=(y+2)/53x = \sqrt[3]{(y+2)/5} is a well-defined real number for every real yy. We verify this xx actually works: substituting back,

f(x)=5(y+253)3−2=5⋅y+25−2=(y+2)−2=y.f(x) = 5\left(\sqrt[3]{\tfrac{y+2}{5}}\right)^3 - 2 = 5 \cdot \frac{y+2}{5} - 2 = (y+2) - 2 = y.

So f(x)=yf(x) = y exactly, as required. Since y∈Ry \in \mathbb{R} was arbitrary, ff is surjective. ✓\checkmark Note how this differs from injectivity proofs: here we did not merely manipulate an equation f(x1)=f(x2)f(x_1) = f(x_2) — we solved for xx in terms of yy 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 A={−3,−2,−1,0,1,2,3}A = \{-3, -2, -1, 0, 1, 2, 3\} and let B={0,1,4,9}B = \{0, 1, 4, 9\}. Define f:A→Bf : A \to B by f(n)=n2f(n) = n^2. Claim: ff is well-defined and surjective, but not injective. Well-definedness check. We must confirm f(n)∈Bf(n) \in B for every n∈An \in A:

f(−3)=9, f(−2)=4, f(−1)=1, f(0)=0, f(1)=1, f(2)=4, f(3)=9.f(-3)=9,\ f(-2)=4,\ f(-1)=1,\ f(0)=0,\ f(1)=1,\ f(2)=4,\ f(3)=9.

Every one of these values, {9,4,1,0}\{9,4,1,0\}, lies in B={0,1,4,9}B = \{0,1,4,9\}, so ff is indeed a function from AA into BB. Surjectivity check. We compute the range directly and compare to BB:

ran⁡(f)={f(n):n∈A}={9,4,1,0,1,4,9}={0,1,4,9}=B.\operatorname{ran}(f) = \{ f(n) : n \in A \} = \{9,4,1,0,1,4,9\} = \{0,1,4,9\} = B.

By Range–Codomain Characterization of Surjectivity (Part 1 above), since ran⁡(f)=B\operatorname{ran}(f) = B, the function ff is surjective. Concretely, exhibiting a preimage for each element of BB: 0=f(0)0 = f(0), 1=f(1)1 = f(1), 4=f(2)4 = f(2), 9=f(3)9 = f(3). Failure of injectivity. Note f(−1)=1=f(1)f(-1) = 1 = f(1) but −1≠1-1 \neq 1, so ff is not injective. This confirms surjectivity is logically independent of injectivity: this ff has every codomain element hit (some multiple times) without being one-to-one. A cautionary variant. Now consider the same rule f(n)=n2f(n) = n^2 but with enlarged codomain B′={0,1,4,9,16}B' = \{0, 1, 4, 9, 16\}. Recomputing, ran⁡(f)\operatorname{ran}(f) is still {0,1,4,9}\{0,1,4,9\} (since AA has not changed), but now ran⁡(f)={0,1,4,9}⊊{0,1,4,9,16}=B′\operatorname{ran}(f) = \{0,1,4,9\} \subsetneq \{0,1,4,9,16\} = B'. So f:A→B′f : A \to B' with the identical rule is not surjective — the value 1616 has no preimage in AA. This illustrates precisely why the codomain must be checked, not just the formula.

CounterexampleWhy the codomain cannot be ignored — dropping the "fix the codomain" discipline

The theorem and its proof rely on treating BB, 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 ff and an informally guessed target set, without pinning down BB precisely. Here is the failure this causes. Let f:Z→Zf : \mathbb{Z} \to \mathbb{Z} be defined by f(n)=2nf(n) = 2n. A careless argument: "For any integer yy I want to hit, I can take n=y/2n = y/2, so ff is surjective." This argument is wrong, and the error is a hidden, unstated restriction that was never verified: n=y/2n = y/2 is only an integer when yy is even. If y=7y = 7, then n=7/2=3.5∉Zn = 7/2 = 3.5 \notin \mathbb{Z}, so there is no n∈Zn \in \mathbb{Z} with f(n)=7f(n) = 7. Indeed,

ran⁡(f)={2n:n∈Z}=2Z={…,−4,−2,0,2,4,…},\operatorname{ran}(f) = \{ 2n : n \in \mathbb{Z} \} = 2\mathbb{Z} = \{\ldots, -4, -2, 0, 2, 4, \ldots\},

the even integers, which is a proper subset of Z\mathbb{Z} (it excludes all odd integers). Since ran⁡(f)=2Z≠Z=B\operatorname{ran}(f) = 2\mathbb{Z} \neq \mathbb{Z} = B, by Range–Codomain Characterization of Surjectivity this ff is not surjective. What went wrong, precisely: the "proof" implicitly solved the equation f(n)=yf(n) = y over the rationals (n=y/2∈Qn = y/2 \in \mathbb{Q}) but never checked that the solution lands back inside the declared domain Z\mathbb{Z}, and by extension never confirmed every target yy in the declared codomain Z\mathbb{Z} is actually reachable. This is exactly the hypothesis that must not be dropped: a surjectivity proof must verify the constructed preimage lies in AA for every element of the actual codomain BB, not merely for a convenient subset of BB, and not over some larger ambient set like Q\mathbb{Q}. Contrast this with the same rule reinterpreted as f:Q→Qf : \mathbb{Q} \to \mathbb{Q}, f(x)=2xf(x) = 2x. Here, for any y∈Qy \in \mathbb{Q}, we have x=y/2∈Qx = y/2 \in \mathbb{Q} (since Q\mathbb{Q} is closed under division by nonzero rationals), so f(x)=2(y/2)=yf(x) = 2(y/2) = y. This version genuinely is surjective. The formula "f(n)=2nf(n)=2n" 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 (A,B,rule)(A, B, \text{rule}), not of the rule in isolation.

Scope, edge cases & common traps

SituationWhat to checkCommon pitfall
A=∅A = \varnothing, B=∅B = \varnothingThe empty function f:∅→∅f:\varnothing\to\varnothing is (vacuously) surjectiveThinking "no elements to map" means automatically not surjective — it's vacuously true
A=∅A = \varnothing, B≠∅B \neq \varnothingNo function ∅→B\varnothing \to B can be surjective if BB has an elementForgetting the empty domain case entirely
AA finite, BB finite, ∣A∣<∣B∣|A| < |B|ff cannot be surjective (pigeonhole, contrapositive form)Trying to force a surjectivity proof when a quick cardinality check refutes it
AA, BB both infiniteSurjectivity does not follow from "AA looks bigger"; must construct preimagesAssuming intuition from finite sets transfers directly to infinite sets
Codomain enlarged after defining ruleRe-verify ran⁡(f)=B\operatorname{ran}(f) = B for the new BBBelieving surjectivity is preserved automatically when codomain changes
Composition g∘fg \circ f surjectiveDoes not imply ff is surjective; does imply gg is surjectiveMisattributing 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
NB
Nicolas Bourbaki (collective pseudonym) & Richard Dedekind
Dedekind: 1831–1916 · foundational set-theoretic function theory

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.

History
- 1831–1916: Richard Dedekind's life span; his foundational essays on numbers and mappings lay groundwork for treating functions between arbitrary sets rigorously.
- 1888: Dedekind publishes Was sind und was sollen die Zahlen?, formalizing mappings ("Abbildungen") between sets, a precursor to the modern function concept including codomain data.
- 1895–1897: Georg Cantor's foundational papers on set theory formalize comparisons of set sizes, implicitly relying on the distinction between injective and surjective correspondences.
- 1935 onward: The Bourbaki collective begins publishing Éléments de mathématique, standardizing the terms injection, surjection, bijection in the set-theoretic language used in this article.
- 1939: Bourbaki's Théorie des ensembles fascicles formally fix the definitions of surjective and injective maps essentially as stated here, cementing the modern terminology.
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 AA 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 BB 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 ran⁡(f)=B\operatorname{ran}(f) = B — so it is really a comparison between the range (determined by AA and the rule) and the codomain BB 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 f:A→Af : A \to A is surjective if and only if it is injective (both are equivalent to ff being a bijection, since ∣A∣=∣A∣|A|=|A| forces a tight pigeonhole argument). For infinite sets this equivalence fails. Consider f:N→Nf : \mathbb{N} \to \mathbb{N} given by f(n)=n+1f(n) = n+1: this is injective but not surjective, since 00 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 f−1({b})f^{-1}(\{b\}), for every bb in a possibly infinite (even uncountable) codomain BB, with no canonical or explicit rule for making all these choices at once. When such a canonical rule exists — for instance, if A⊆NA \subseteq \mathbb{N}, one can always choose the least element of each fiber using the well-ordering of N\mathbb{N} — 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 gg exists.

Is checking ran⁡(f)=B\operatorname{ran}(f) = B 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 b∈Bb \in B and producing (or proving existence of) some a∈Aa \in A with f(a)=bf(a) = b — a "chase forward from the target" argument. Computing ran⁡(f)\operatorname{ran}(f) explicitly and comparing it to BB works well when AA and BB are small or finite, as in Example 2. For infinite or algebraically defined domains, the direct method (solving f(a)=bf(a) = b for aa) is usually more tractable, as in Example 1.

How does surjectivity interact with function composition in general?

If f:A→Bf : A \to B and g:B→Cg : B \to C are both surjective, then g∘f:A→Cg \circ f : A \to C is surjective: given c∈Cc \in C, surjectivity of gg gives b∈Bb \in B with g(b)=cg(b) = c, and surjectivity of ff gives a∈Aa \in A with f(a)=bf(a) = b, so (g∘f)(a)=g(f(a))=g(b)=c(g\circ f)(a) = g(f(a)) = g(b) = c. Conversely, if g∘fg \circ f is surjective, one can prove gg must be surjective (given c∈Cc \in C, take aa with (g∘f)(a)=c(g\circ f)(a)=c, then b=f(a)b = f(a) satisfies g(b)=cg(b) = c), but ff 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 AA "onto" all of BB, as opposed to merely "into" BB (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 ("ff maps AA onto BB") and "surjective" as a plain adjective ("ff is surjective"), but the mathematical content is word-for-word identical.

Before this

Where this leads