Bijections and Inverse Functions
When can we "undo" a function, recovering the input exactly from the output? This question sounds innocent. Yet it is the hinge on which an enormous amount of mathematics turns. A function that can be undone — reversed step for step by another function — is called a bijection. Its reversal is its inverse. Understanding exactly when this reversal exists is essential. So is understanding why it must be unique when it does. This forces us to confront two independent ways a function can fail to be reversible. It can lose information (two inputs collapsing to one output). Or it can fail to cover the target (some outputs never occur). Bijections are precisely the functions immune to both failures. The idea matters far beyond bookkeeping. Bijections are the mathematical embodiment of "same size" for sets, finite or infinite. They are the symmetries that group theory studies. They let us relabel coordinate systems, re-index sums, and transport structure from one set to an isomorphic copy of it. Cryptographic ciphers are bijections on blocks of data. This is precisely because a legitimate user must be able to decrypt. Change-of-variables formulas in calculus depend on this notion. So does permutation counting in combinatorics. So does the definition of cardinality for infinite sets. The big picture is this: injectivity and surjectivity are complementary constraints. One is about not merging distinct elements. The other is about hitting everything. A function satisfying both simultaneously acquires a genuine two-sided inverse. It gets more than just a partial or one-sided patch. This is not automatic. One-sided inverses can exist under weaker hypotheses. They behave quite differently, though. Sorting out precisely which combination of hypotheses yields precisely which kind of inverse is the technical heart of this article. This article gives the exact definition of a bijection. It proves the central existence-and-uniqueness theorem for two-sided inverses. It works through two concrete non-trivial examples. One example concerns finite sets; the other, real-valued functions. It also exhibits a careful counterexample. This shows why both injectivity and surjectivity are indispensable. It closes with the historical origins of the concept. It also covers its uses across mathematics and beyond, and a compact reference card.
- A bijection is a function that is both injective (one-to-one) and surjective (onto).
- Bijections are exactly the functions that admit a genuine two-sided inverse .
- The inverse of a bijection is itself a bijection, and it is unique when it exists.
- Injectivity alone gives a left inverse (on nonempty domains); surjectivity alone gives a right inverse (using choice); only both together give a true inverse.
- Composition interacts cleanly with inverses: when both are bijections.
- Key idea: a function is reversible exactly when it neither loses information (injective) nor misses part of the target (surjective).
Where this lives today
Bijections are the working definition of "the same size" used throughout mathematics, most explicitly in Finite Sets and Counting, where a bijection between a finite set and is the definition of "having elements," and in the theory of infinite cardinal numbers, where two sets are declared to have equal cardinality exactly when a bijection between them exists (this is how one proves ). In algebra, the automorphisms of any structure — bijective structure-preserving self-maps — form a group under Composition of Functions, and permutation groups are literally groups of bijections of a finite set to itself. In analysis, the Inverse Function Theorem gives local conditions under which a differentiable map is a bijection near a point and computes the derivative of the resulting inverse. In cryptography, block ciphers such as AES are, for each fixed key, bijections on the space of possible blocks — this is mathematically forced, since a legitimate recipient must be able to decrypt uniquely. In computer science, hash functions used for perfect hashing and bijective encodings (e.g. Gödel numbering schemes, Cantor pairing functions) rely on explicit bijections between combinatorial structures and . In statistics and probability, change-of-variables formulas for densities require the transforming map to be a (locally) bijective, differentiable function so that the inverse and its Jacobian are well defined.
Ask the tutor: Why does surjectivity alone require the Axiom of Choice to build a right inverse, while injectivity alone does not need choice for a left inverse?
Let and be sets and let be a function.
- is injective (one-to-one) if for all , implies .
- is surjective (onto ) if for every there exists with .
- is a bijection (or a bijective correspondence, or a one-to-one correspondence) from to if is both injective and surjective.
Given a function , a function is called:
- a left inverse of if , i.e. for all ;
- a right inverse of if , i.e. for all ;
- a (two-sided) inverse of if is both a left inverse and a right inverse of .
When a two-sided inverse of exists, it is denoted .
Intuition
Think of a function as a machine that assigns to each element of an arrow pointing into . Two things can go wrong if you try to build a "reverse machine" that sends each output back to where it came from. First, two different inputs might point to the same output — then the reverse machine would not know which one to send you back to. This failure is exactly the failure of injectivity. Second, some element of might have no arrow pointing at it at all — then the reverse machine has nothing to do when handed that element. This failure is exactly the failure of surjectivity. A bijection is a diagram of arrows with none of these defects: every element of has exactly one arrow coming in. Reversing every arrow then produces a perfectly well-defined function — the inverse. This is why the two hypotheses are not redundant with each other: injectivity handles the "too many inputs share an output" problem, surjectivity handles the "some outputs are orphaned" problem, and a genuine reversal needs both problems solved simultaneously.
The central theorem
Let and be sets and let be a function. Then the following are equivalent: 1. is a bijection (injective and surjective). 2. has a two-sided inverse, that is, there exists with and . Moreover, when a two-sided inverse of exists, it is unique; consequently is well-defined, it is itself a bijection , and .
We prove , then , then uniqueness, then the closing remarks. The technique throughout is direct construction and verification from the definitions, together with a standard uniqueness argument via composition.
. Suppose is injective and surjective. We construct explicitly. Let be arbitrary. Since is surjective, the set is nonempty; choose some . We claim this is unique: if both satisfy , then , and injectivity of gives . Hence for each there is exactly one with ; call it . This rule defines a function (formally, is the set of pairs , and the argument just given shows this relation assigns to each exactly one , so it is a function). We check is a two-sided inverse of . : let and set . By definition, is the unique element of mapping to under ; since , uniqueness forces . Thus for every , i.e. . : let . By construction directly, since was chosen (and shown unique) precisely as an element with . Thus . Hence is a two-sided inverse of , proving .
. Suppose satisfies and . We show is injective and surjective. Injectivity: suppose with . Apply to both sides: . Since , the left side is and the right side is . Hence . So is injective. Surjectivity: let be arbitrary. Set . Then
using . So is in the range of . Since was arbitrary, is surjective. Hence is a bijection, proving .
Uniqueness of the inverse. Suppose are both two-sided inverses of : and . We show as functions, i.e. for every . Fix . Using associativity of composition of functions (which holds because composition of functions is literally composition of relations/set-theoretic maps, and this is associative — a fact independent of and prior to the present theorem), compute:
Each equality uses only the defining identities , , and the identity laws , for the relevant . Hence as functions . This proves uniqueness, so we may unambiguously write for the two-sided inverse of a bijection .
is itself a bijection, and . By the defining property, and . Reading these two equations as saying " is a two-sided inverse of " (the two equations are exactly the two required identities, with the roles of and swapped), we conclude has as a two-sided inverse. By the already-proved direction applied to in place of , is itself a bijection. By uniqueness of inverses (already proved) applied to , its unique two-sided inverse is , i.e. .
∎If and are bijections, then is a bijection, and
Since and are bijections, by the theorem they have two-sided inverses and . Define . We check is a two-sided inverse of , using associativity of composition:
So is a two-sided inverse of . By the theorem's direction, is a bijection, and by uniqueness of inverses, .
∎Worked examples
Example 1 (finite, asymmetric sets — explicit bijection and its inverse). Let and (note: has abstract labels, has concrete distinct primes — deliberately asymmetric so no hidden relabeling coincidence can mask an error). Define by
Checking injectivity. The four output values listed for are pairwise distinct. Hence no two distinct inputs share an output, so is injective. (Formally: if with then two of would coincide, which is false by inspection of the four values.) Checking surjectivity. and the range of is . So every element of is hit, and is surjective. Hence is a bijection. By the theorem, has a unique two-sided inverse . Following the proof's construction, is the unique with :
Verification of both identities directly. Compute for each :
So on all four elements. Compute for each :
So on all four elements. Both identities hold on every element of the (finite) domains, so is genuinely a two-sided inverse, confirming the theorem's guarantee.
Example 2 (a bijection between intervals of different lengths, with explicit formula for the inverse). Let and , two closed real intervals of different lengths ( versus — chosen asymmetrically to avoid the misleading special case of equal-length intervals). Define
(We use the monotone affine map , since a quadratic would not be injective on an interval containing both signs of vertex; affine maps are automatically injective when the slope is nonzero, which we verify below.) Checking injectivity. Suppose , i.e. . Adding to both sides gives , and dividing by (nonzero) gives . So is injective on all of , in particular on . Checking that maps into . is increasing (slope ), so its minimum and maximum on occur at the endpoints: and . Since is continuous and strictly increasing, (this uses the Intermediate Value Theorem to guarantee every value between and is attained, plus monotonicity to guarantee no value is skipped or repeated). Checking surjectivity onto . We just showed exactly, so every element of is attained: is surjective onto . Hence is a bijection. Solve for :
So define for . Check maps into : , , and is increasing, so , matching the domain . Verify both composite identities symbolically (not just at endpoints). For :
For :
Both identities hold for every point in the respective domains (not merely at a few sample points), confirming rigorously. Note the inverse of a bijection between intervals of different lengths ( vs. ) still exists and is affine — bijectivity does not require any relation between the "sizes" as measured by length, only the exact correspondence described in the definition.
The theorem requires to be both injective and surjective to guarantee a two-sided inverse. We exhibit two functions, each satisfying exactly one of the two hypotheses, and show each fails to have a two-sided inverse — though each does admit a one-sided inverse, which is instructive in itself.
Failure of surjectivity (injective but not surjective). Let , , and define . Injective: if then (divide by ). So is injective. Not surjective: the value is never attained, since has no integer solution (). So is not surjective onto . Suppose toward contradiction that were a two-sided inverse of . Then would require , i.e. — impossible for an integer . So no two-sided inverse exists, exactly as the theorem's necessity direction predicts, since fails surjectivity. What does exist is a left inverse: define by if is even, if is odd. Then for all , so : a left inverse exists precisely because is injective, but is not a right inverse, since . This shows injectivity alone buys a left inverse but not a two-sided one.
Failure of injectivity (surjective but not injective). Let , , and define . Surjective: for any , satisfies . So is surjective onto . Not injective: but . So is not injective. Suppose toward contradiction were a two-sided inverse. Then would require and ; but , so would have to equal both and simultaneously — impossible, since is a single value. So no two-sided inverse exists, exactly because fails injectivity. What does exist is a right inverse: define by (the nonnegative square root). Then for all , so : a right inverse exists precisely because is surjective. But is not a left inverse: . These two examples show the two hypotheses are logically independent obstructions, each capable by itself of destroying two-sidedness, and each capable by itself of still producing a weaker, one-sided inverse.
Scope, edge cases & common traps
| Situation | What holds | What can fail |
|---|---|---|
| injective only | Left inverse exists (if ) | Right inverse generally fails; left inverse not unique if not also surjective |
| surjective only | Right inverse exists (needs Axiom of Choice in general) | Left inverse generally fails; right inverse not unique |
| bijective | Two-sided inverse exists and is unique | — |
| , | No function ... wait, unique empty function exists but cannot be surjective unless | Vacuous edge case: check surjectivity fails unless |
| Infinite sets | Bijection can exist between a set and a proper subset (e.g. evens) | "Same size" intuition from finite sets breaks; this is normal, not an error |
| Constructing right inverse from surjectivity alone | Requires choosing one preimage per point of | For infinite this genuinely requires the Axiom of Choice |
The mathematician behind it
Origins · 1 minGeorg Cantor and how this was discovered
Georg Cantor founded set theory and, in doing so, made the notion of bijection the precise tool for comparing the sizes of infinite collections. His 1874 discovery that there is no bijection between and (via the diagonal argument), contrasted with his earlier discovery of an explicit bijection between and , showed for the first time that infinities come in different sizes — a conclusion that depends entirely on treating "bijection exists" as the correct formal meaning of "same cardinality."
Is every function with an inverse automatically a bijection?
Yes, provided "inverse" means genuine two-sided inverse as defined here. The theorem's direction proves exactly this: if some satisfies both and , then must be injective (apply to an equality of outputs to force equality of inputs) and surjective (for any target , is an explicit preimage). The subtlety is the word "two-sided": a function can have a left inverse or a right inverse without being a bijection, as the counterexample block shows. Colloquially, "has an inverse" almost always means two-sided inverse, in which case the equivalence is exact and unconditional.
Does constructing a right inverse from surjectivity really need the Axiom of Choice?
For a general surjection , yes: to build with , you must select, for each , one element from the (nonempty, by surjectivity) preimage set , and doing this simultaneously for possibly infinitely many with no canonical rule is precisely an instance of the Axiom of Choice. When is also injective (i.e. bijective), no choice is needed because each preimage set is a singleton, so there is nothing to choose — the theorem's proof of is fully constructive and choice-free. Choice becomes essential exactly at the point where surjectivity alone, without injectivity, is used to manufacture a section.
Can a set be in bijection with a proper subset of itself?
Yes, and this is completely consistent with the theory — it is one of the defining features of infinite sets. The map , , restricted in codomain to the even naturals , is a bijection : it is injective as shown in the counterexample block, and surjective onto since every even number is for some . A classical theorem (Dedekind) even defines an infinite set as one admitting a bijection with a proper subset of itself; finite sets never admit such a bijection, which is part of why "same cardinality via bijection" behaves so differently once we leave the finite world, foreshadowing Finite Sets and Counting.
What goes wrong if I only check injectivity or only check surjectivity before writing ""?
Writing presupposes that there is exactly one with : existence of such an is surjectivity, uniqueness is injectivity. If you only verify injectivity, may be undefined for some (nothing maps to ), producing a partial function masquerading as a total one. If you only verify surjectivity, may be ambiguous (several valid 's), so "" is not a well-defined function at all — at best you get a relation, or you must arbitrarily select one preimage using choice, losing the right to call the result "the" inverse.
How does this relate to the Cantor–Schröder–Bernstein theorem?
The Cantor–Schröder–Bernstein theorem addresses a related but distinct question: given only an injection and an injection (neither assumed surjective), it proves a bijection exists nonetheless, constructed by splicing pieces of and together. It is a genuinely different and harder theorem than the one here, because here we assume a single function is both injective and surjective, whereas Cantor–Schröder–Bernstein derives the existence of some bijection from two one-directional injections that individually need not be surjective. The present theorem is the tool used inside that proof once the final bijective map has been assembled.
Is the identity function always a bijection, and is it its own inverse?
Yes. For any set , defined by is injective (if trivially ) and surjective (every equals ), hence a bijection. Its two-sided inverse must satisfy and ; taking satisfies both, and uniqueness of inverses (proved above) forces this to be the only possibility. So , consistent with the general fact applied when is already self-inverse.
Why does the proof of uniqueness use associativity of composition, and is that circular?
The uniqueness argument computes , which requires regrouping two different ways — that is associativity. This is not circular: associativity of function composition is a basic fact about composing set-theoretic relations, provable directly from the definition without any reference to injectivity, surjectivity, or inverses. It is logically prior to, and independent of, the bijection theorem, so invoking it here introduces no circularity.