Bijection, injection and surjection

surjective non-surjective
injective

bijective

injective-only

non-

injective

surjective-only

In mathematics, injections, surjections and bijections are classes of functions distinguished by the manner in which arguments (input expressions from the domain) and images (output expressions from the codomain) are related or mapped to each other.

A function maps elements from its domain to elements in its codomain. Given a function ${\displaystyle f:\;X\to Y}$

• The function is injective (one-to-one) if each element of the codomain is mapped to by at most one element of the domain. An injective function is an injection. Notationally:
${\displaystyle \forall x,x'\in X,f(x)=f(x')\Rightarrow x=x'.}$
Or, equivalently (using logical transposition),
${\displaystyle \forall x,x'\in X,x\neq x'\Rightarrow f(x)\neq f(x').}$
• The function is surjective (onto) if each element of the codomain is mapped to by at least one element of the domain. (That is, the image and the codomain of the function are equal.) A surjective function is a surjection. Notationally:
${\displaystyle \forall y\in Y,\exists x\in X{\text{ such that }}y=f(x).}$
• The function is bijective (one-to-one and onto or one-to-one correspondence) if each element of the codomain is mapped to by exactly one element of the domain. (That is, the function is both injective and surjective.) A bijective function is a bijection.

An injective function need not be surjective (not all elements of the codomain may be associated with arguments), and a surjective function need not be injective (some images may be associated with more than one argument). The four possible combinations of injective and surjective features are illustrated in the adjacent diagrams.

Injection

Injective composition: the second function need not be injective.

A function is injective (one-to-one) if each possible element of the codomain is mapped to by at most one argument. Equivalently, a function is injective if it maps distinct arguments to distinct images. An injective function is an injection. The formal definition is the following.

The function ${\displaystyle f:X\to Y}$ is injective iff for all ${\displaystyle x,x'\in X}$, we have ${\displaystyle f(x)=f(x')\Rightarrow x=x'.}$
• A function f : XY is injective if and only if X is empty or f is left-invertible; that is, there is a function g : f(X) → X such that g o f = identity function on X. Here f(X) is the image of f.
• Since every function is surjective when its codomain is restricted to its image, every injection induces a bijection onto its image. More precisely, every injection f : XY can be factored as a bijection followed by an inclusion as follows. Let fR : Xf(X) be f with codomain restricted to its image, and let i : f(X) → Y be the inclusion map from f(X) into Y. Then f = i o fR. A dual factorisation is given for surjections below.
• The composition of two injections is again an injection, but if g o f is injective, then it can only be concluded that f is injective. See the figure at right.
• Every embedding is injective.

Surjection

Surjective composition: the first function need not be surjective.

A function is surjective (onto) if each possible image is mapped to by at least one argument. In other words, each element in the codomain has non-empty preimage. Equivalently, a function is surjective if its image is equal to its codomain. A surjective function is a surjection. The formal definition is the following.

The function ${\displaystyle f:X\to Y}$ is surjective iff for all ${\displaystyle y\in Y}$, there is ${\displaystyle x\in X}$ such that ${\displaystyle f(x)=y.}$
• A function f : XY is surjective if and only if it is right-invertible, that is, if and only if there is a function g: YX such that f o g = identity function on Y. (This statement is equivalent to the axiom of choice.)
• By collapsing all arguments mapping to a given fixed image, every surjection induces a bijection defined on a quotient of its domain. More precisely, every surjection f : XY can be factored as a non-bijection followed by a bijection as follows. Let X/~ be the equivalence classes of X under the following equivalence relation: x ~ y if and only if f(x) = f(y). Equivalently, X/~ is the set of all preimages under f. Let P(~) : XX/~ be the projection map which sends each x in X to its equivalence class [x]~, and let fP : X/~ → Y be the well-defined function given by fP([x]~) = f(x). Then f = fP o P(~). A dual factorisation is given for injections above.
• The composition of two surjections is again a surjection, but if g o f is surjective, then it can only be concluded that g is surjective. See the figure.

Bijection

Bijective composition: the first function need not be surjective and the second function need not be injective.

A function is bijective if it is both injective and surjective. A bijective function is a bijection (one-to-one correspondence). A function is bijective if and only if every possible image is mapped to by exactly one argument. This equivalent condition is formally expressed as follow.

The function ${\displaystyle f:X\to Y}$ is bijective iff for all ${\displaystyle y\in Y}$, there is a unique ${\displaystyle x\in X}$ such that ${\displaystyle f(x)=y.}$
• A function f : XY is bijective if and only if it is invertible, that is, there is a function g: YX such that g o f = identity function on X and f o g = identity function on Y. This function maps each image to its unique preimage.
• The composition of two bijections is again a bijection, but if g o f is a bijection, then it can only be concluded that f is injective and g is surjective. (See the figure at right and the remarks above regarding injections and surjections.)
• The bijections from a set to itself form a group under composition, called the symmetric group.

Cardinality

Suppose you want to define what it means for two sets to "have the same number of elements". One way to do this is to say that two sets "have the same number of elements" if and only if all the elements of one set can be paired with the elements of the other, in such a way that each element is paired with exactly one element. Accordingly, we can define two sets to "have the same number of elements" if there is a bijection between them. We say that the two sets have the same cardinality.

Likewise, we can say that set ${\displaystyle X}$ "has fewer than or the same number of elements" as set ${\displaystyle Y}$ if there is an injection from ${\displaystyle X}$ to ${\displaystyle Y}$. We can also say that set ${\displaystyle X}$ "has fewer than the number of elements" in set ${\displaystyle Y}$ if there is an injection from ${\displaystyle X}$ to ${\displaystyle Y}$ but not a bijection between ${\displaystyle X}$ and ${\displaystyle Y}$.

Examples

It is important to specify the domain and codomain of each function since by changing these, functions which we think of as the same may have different jectivity.

Injective and surjective (bijective)

• For every set X the identity function idX and thus specifically ${\displaystyle \mathbf {R} \to \mathbf {R} :x\mapsto x}$.
• ${\displaystyle \mathbf {R} ^{+}\to \mathbf {R} ^{+}:x\mapsto x^{2}}$ and thus also its inverse ${\displaystyle \mathbf {R} ^{+}\to \mathbf {R} ^{+}:x\mapsto {\sqrt {x}}}$.
• The exponential function ${\displaystyle \exp :\mathbf {R} \to \mathbf {R} ^{+}:x\mapsto \mathrm {e} ^{x}}$ and thus also its inverse the natural logarithm ${\displaystyle \ln :\mathbf {R} ^{+}\to \mathbf {R} :x\mapsto \ln {x}}$

Injective and non-surjective

• The exponential function ${\displaystyle \exp :\mathbf {R} \to \mathbf {R} :x\mapsto \mathrm {e} ^{x}}$

Non-injective and surjective

• ${\displaystyle \mathbf {R} \to \mathbf {R} :x\mapsto (x-1)x(x+1)=x^{3}-x}$
• ${\displaystyle \mathbf {R} \to [-1,1]:x\mapsto \sin(x)}$

Non-injective and non-surjective

• ${\displaystyle \mathbf {R} \to \mathbf {R} :x\mapsto \sin(x)}$

Properties

• For every function f, subset X of the domain and subset Y of the codomain we have Xf −1(f(X)) and f(f −1(Y)) ⊂ Y. If f is injective we have X = f −1(f(X)) and if f is surjective we have f(f −1(Y)) = Y.
• For every function h : XY we can define a surjection H : Xh(X) : x → h(x) and an injection I : h(X)Y : x → x. It follows that h = IH. This decomposition is unique up to isomorphism.

Category theory

In the category of sets, injections, surjections, and bijections correspond precisely to monomorphisms, epimorphisms, and isomorphisms, respectively.

History

This terminology was originally coined by the Bourbaki group.