Injective Functions
Can two different inputs to a function ever produce the same output? For some functions the answer is always no. These functions turn out to be exactly the ones that can be "undone" on their range. This single question — does distinctness of inputs guarantee distinctness of outputs — is the heart of the notion of an injective function, also called a one-to-one function. It sounds like a small technical property. But it is one of the load-bearing walls of modern mathematics. It is the precise tool used to compare the sizes of infinite sets, to embed one structure inside another without collapsing information, and to certify that an operation like encryption or hashing does not destroy distinctions between messages. The idea matters because "size" and "sameness" for infinite collections cannot be checked by counting. Instead, mathematicians certify that one set is "at least as large as" another by exhibiting an injective function from the first into the second. This is a rule that assigns to each element of the first set a distinct partner in the second. Injectivity is therefore the engine behind the entire theory of Comparing Cardinalities. This includes the celebrated fact that the real numbers outnumber the natural numbers. The big picture is this: a function is a package of input–output pairs satisfying a rule (see Functions as Special Relations). Injectivity is one of the two independent properties — the other being surjectivity. Their conjunction (bijectivity) makes a function reversible. Understanding injectivity in isolation, with clean proof techniques, is the prerequisite for understanding Bijections and Inverse Functions correctly. An inverse function can only be defined without ambiguity when the original function never sends two points to the same place. This article gives the precise definition of injectivity, the standard proof strategies (direct argument and contrapositive), a full worked derivation for both a polynomial-type and a piecewise function, a theorem connecting injectivity to left-invertibility, and a counterexample showing exactly what fails when the codomain is chosen carelessly.
- An injective (one-to-one) function never sends two distinct inputs to the same output.
- Formally: is injective iff for all in the domain.
- The standard proof technique is the direct argument or its logical twin, the contrapositive: .
- Injectivity is equivalent to the existence of a left inverse function (a retraction), when the domain is nonempty.
- Graphically, injectivity is the horizontal line test: no horizontal line meets the graph more than once.
- Key idea: injectivity is a promise that the function loses no information — it is the algebraic seed of comparing the sizes of sets.
Where this lives today
Injectivity is not a museum piece confined to introductory proof courses — it is load-bearing machinery across mathematics and its applications.
- Cardinality and set theory. The relation is defined by the existence of an injection ; the Cantor–Schröder–Bernstein theorem shows that mutual injections and force a bijection to exist, the technical foundation for Comparing Cardinalities.
- Linear algebra. A linear map between vector spaces is injective if and only if its kernel is ; this single fact converts an infinite verification into a one-line computation, and underlies rank-nullity arguments.
- Cryptography. Encryption functions must be injective (for a fixed key) so that decryption — a left inverse in the exact sense of the theorem above — is possible; a non-injective cipher would make some ciphertexts undecryptable to a unique plaintext.
- Hash functions and data structures. Ideal hash functions aim to approximate injectivity ("collision resistance"); the entire theory of hash collisions is the theory of failures of injectivity, studied quantitatively via the birthday bound.
- Real analysis. Strictly monotonic functions (strictly increasing or strictly decreasing) are always injective, giving a fast sufficient criterion used constantly when justifying the existence of inverse functions like , (on restricted domains), and root functions.
- Computer science. Injective functions model perfect encodings: lossless compression schemes and unique object identifiers (serial numbers, memory addresses under certain guarantees) are required to be injective on their domain of legitimate inputs.
- Category theory. The categorical generalization of "injective" is a monomorphism, defined by a left-cancellation property that specializes exactly to the set-theoretic definition given here when working in the category of sets.
Ask the tutor: How does injectivity of a function combine with surjectivity to prove the Cantor–Schröder–Bernstein theorem when comparing infinite sets?
Let be a function, i.e., a subset of satisfying the functional condition that every has exactly one with (written ). We say is injective, or one-to-one, if it satisfies:
Equivalently, by contraposition, is injective iff
A function that is not injective is called many-to-one: there exist in with .
Intuition
Think of a function as a machine with input slot and output slot . Injectivity says the machine keeps a perfect paper trail: if you only ever see the output, you can still work out which input produced it, provided you know the output came from this function at all. Nothing is ever "merged." Two different students never get assigned the same locker; two different countries never get the same capital-city code; two different DNA sequences (in an idealized world) never hash to the same fingerprint. This is exactly the geometric content of the horizontal line test for real-valued functions of a real variable: draw the graph of , and draw any horizontal line . If is injective, that line can touch the graph in at most one point, because two intersection points would be two different -values sharing the same output . It is essential to keep injectivity conceptually separate from surjectivity (hitting every element of ) — a function can miss most of and still be injective, as long as it never doubles up on the elements it does hit. The rectangle-and-arrows picture below makes this visible: every arrow lands on a different target, but some targets in receive no arrow at all. That is completely compatible with injectivity.
Proof techniques in practice
There are exactly two standard logical strategies for establishing is injective, and one standard strategy for refuting it. 1. Direct proof of the implication. Fix arbitrary , assume , and derive using algebra or the definition of . 2. Contrapositive proof. Fix arbitrary with , and show . This is logically equivalent to the direct method and is often easier when involves strict monotonicity or absolute values. 3. Refutation by counterexample. To show is not injective, it suffices to exhibit one explicit pair with — an existential witness, not a universal argument.
Let be a function with . Then is injective if and only if there exists a function such that
where is the identity function on . Such a is called a left inverse, or retraction, of .
We prove both directions. The proof technique is direct construction in one direction and a direct algebraic argument in the other; neither direction uses any fact about surjectivity or bijections, so there is no circularity with Bijections and Inverse Functions, which is built on top of this result rather than beneath it.
() Suppose a left inverse exists with . Let with . Apply to both sides; since is a function, equal inputs to give equal outputs, so
By definition of composition, the left side is and the right side is . Since , this reads
that is, . This is exactly the definition of injectivity, so is injective.
() Suppose is injective and . Fix any element (possible since is nonempty). Define by:
We must check is well-defined as a function, i.e., that the first case never assigns two different values to the same . Suppose and also for some . Then , and since is injective, . Hence the value assigned by the first clause is unique whenever it applies, and the two clauses never overlap (the first applies exactly when , the second exactly when ). So is a well-defined function . Now verify . Let be arbitrary and set . Then by construction (witnessed by itself), so the first clause of applies: . Hence
Since was arbitrary, , so is a left inverse of .
∎If and are both injective, then is injective.
Let with , i.e. . Since is injective, this gives . Since is injective, this gives . This is the direct proof technique applied twice in sequence, and it establishes injectivity of .
∎Worked examples
Example 1 — a rational (non-polynomial) function, asymmetric domain. Let — the reals excluding the single point — and let . Define
We claim is injective. First check is well-defined into : for , so is defined, and since a nonzero numerator over a finite denominator is never ; so indeed for all . Direct proof of injectivity. Let with :
Both denominators are nonzero (since ), so we may cross-multiply:
Dividing both sides by (nonzero), , hence . This establishes injectivity directly, verifying the definition for arbitrary . Sanity check with actual numbers. Take : . Take : . Indeed and , consistent with injectivity — no collision occurs. Take again with a different candidate : , again no collision, as guaranteed by the theorem above since . Left inverse, explicitly constructed as in the theorem. Since here (one can check every nonzero real is hit: given , solve to get ), the left inverse is total on and is given by
Check: . This matches , confirming injectivity via the equivalence proved above.
Example 2 — a piecewise function requiring case analysis. Define by
(This is a classical pairing-style function: nonnegative integers go to nonnegative even numbers, negative integers go to nonnegative odd numbers.) We show is injective using the contrapositive strategy combined with case analysis, since the formula itself splits into cases. Suppose in . We must show . There are three sub-cases depending on the signs of . Case A: . Then and . If then , so , contradicting . So in this case. Case B: . Then and . If these were equal, , so , again a contradiction. So . Case C: one is and the other (WLOG ). Then is even and nonnegative, while is odd (since is even, subtracting makes it odd). An even number can never equal an odd number, so automatically — no algebra even needed here, only parity. Since all three exhaustive cases give , the contrapositive holds for every pair with , so is injective. Numeric check. . . . . All four outputs are distinct, consistent with injectivity, and note the outputs are exactly — a mix of small evens and odds, matching the parity argument in Case C (evens from nonnegative inputs, odds from negative inputs).
Why the domain/codomain framing matters
The universal quantifier over all pairs in the definition is not decorative — weakening it to "for all pairs in some proper subset" can make a genuinely non-injective function look injective. Consider
Suppose a careless argument checks injectivity only on pairs of nonnegative reals: for with , taking nonnegative square roots gives . This step is entirely correct restricted to . If one then (wrongly) concludes " is injective on " by forgetting that the definition demands the implication for every pair drawn from the full domain , the conclusion is false. Indeed, take and , both in , with . Then
a genuine collision. So is not injective on , even though it is injective when the domain is restricted to or to . This shows precisely what the universal quantifier over the whole stated domain is protecting against: injectivity is not a property of a formula alone, but of a formula together with a specified domain. Changing the domain from to changes the truth value of "is injective" even though the algebraic rule never changes.
Scope, edge cases & common traps
| Situation | What to check | Common error |
|---|---|---|
| Domain is a proper subset of a larger natural domain | Injectivity must hold on the stated domain, not some ambient superset | Forgetting the restriction and testing points outside it |
| Codomain larger than the range | Injectivity says nothing about hitting every element of | Confusing injective with surjective/bijective |
| Empty domain | The universal statement is vacuously true: is injective by default | Assuming injectivity requires a nonempty witness; it does not |
| Piecewise formulas | Must rule out cross-case collisions, not just within-case collisions | Checking each branch separately and skipping the "one from each branch" case |
| Finite sets | If , no function can be injective (pigeonhole) | Trying to construct an injection anyway instead of citing the counting argument |
The mathematician behind it
Origins · 1 minNicolas Bourbaki (collective pseudonym) and how this was discovered
The terms "injective," "surjective," and "bijective" were coined and standardized by the Bourbaki group, a collective of mostly French mathematicians writing under a shared pseudonym starting in the 1930s. Their multi-volume Éléments de mathématique fixed the modern set-theoretic vocabulary for functions that undergraduates use today, replacing older, less uniform terminology like "one-to-one" (still common in English-language texts as a synonym for injective) and "onto" (for surjective). The idea of injectivity itself is far older — implicit already in Cantor's late-19th-century work comparing the sizes of infinite sets — but the crisp trichotomy of injective/surjective/bijective, and the systematic proof style built around it, is a 20th-century codification.
Is "injective" the same thing as "one-to-one"?
Yes — in most English-language textbooks, "injective" and "one-to-one" are exact synonyms, both meaning distinct inputs always give distinct outputs. The word "injective" (and "injection" for the function itself) is the term standardized by the Bourbaki school and used in more formal or research-level writing, while "one-to-one" is the older, still very common phrasing in introductory courses. Be careful with the closely related but different phrase "one-to-one correspondence," which is a synonym for bijective, not merely injective — the word "correspondence" is doing important extra work there, signaling that the function is also surjective.
Can an injective function fail to be surjective, and vice versa?
Yes to both, and they are logically independent properties. The function given by is injective (distinct naturals double to distinct naturals) but not surjective, since no odd number is ever hit. Conversely, given by and for is surjective (every natural number is hit by ) but not injective, since . A function that is both injective and surjective is called bijective, the subject of Bijections and Inverse Functions.
How does injectivity interact with function composition when the composite is injective but the pieces are not?
If is injective, it forces itself to be injective: if then , so , and injectivity of the composite forces . However, this argument says nothing about on its own — can be wildly non-injective outside the range of . For instance, let send , and let send every real to except that is not even required; here is trivially injective (a one-point domain always gives an injective function) despite collapsing everything else. So "composite injective" only certifies the first map, not the second.
Is the empty function injective?
Yes, vacuously. If , then is the empty set of pairs, and the defining implication "" has a universally quantified statement over an empty domain. Since there are no elements of to serve as counterexamples, the universal statement is vacuously true, exactly as with any universally quantified claim over an empty set. This is a standard and important edge case, not a paradox.
Does injectivity depend only on the formula, or also on the stated domain and codomain?
It depends on all three together — the formula, the domain, and (for well-definedness, though not directly for injectivity) the codomain. As shown in the counterexample above, is injective as a function but not as a function , even though the algebraic rule never changes. Whenever you assert " is injective," you are implicitly asserting it about a fully specified function — rule plus domain — not about a bare formula. Always state the domain explicitly before checking injectivity.
What is the fastest sufficient condition for injectivity of a real function, without doing the full algebraic proof?
For a function defined on an interval, if is strictly increasing (i.e. ) or strictly decreasing throughout its domain, then is automatically injective: distinct points get strictly ordered outputs, which are therefore unequal. This is provable directly from the trichotomy of real numbers (, , or ) applied case by case. In calculus, checking (or ) on an interval is the usual shortcut to strict monotonicity, and hence to injectivity, without doing an algebraic solve of .
How does injectivity generalize beyond functions on sets, say to structures with extra properties?
In algebra, an injective homomorphism between groups, rings, or vector spaces is a structure-preserving map that is also injective as a set function; for linear maps this reduces to the map having trivial kernel. In category theory more broadly, the right generalization is a monomorphism: a morphism such that implies for all morphisms with matching codomain. In the category of sets this categorical definition is provably equivalent to the elementwise definition given in this article, but in other categories (e.g. rings) monomorphisms and set-theoretic injections can occasionally diverge in subtle ways, which is part of why category theory treats "injective" and "monomorphism" as related but formally distinct notions.