Function Glossary: Injection, Surjection, and Bijection
In set theory, it is important to know how the elements of one set are mapped to another by a function.
It is important to recall that functions have only a single output for a given input, thus passing the "vertical line test".
The domain of a function is the set of all possible input values.
The range of a function is most often used to describe the values taken on by a function within its domain, known as the image, but is sometimes used to mean the set of all possible output values for the function, the codomain.
The codomain of a function is, by definition, a superset of its image. For instance, the image of `f:\mathbb R\mapsto\mathbb R, f(x)=x^2` is `[0,\infty)`,
the set of nonnegative real numbers, whereas the codomain is `\mathbb R`, the set of all real numbers.
The inverse `g` of a function `f` that has domain `X` and image `Y` will have domain `Y` and image `X`, and composing the two functions `(f\circ g)` or `(g\circ f)` will result in the identity function.
Injective functions are those where every output has only a single input, or alternatively, where `f(x)=f(y) \implies x=y`.
These functions pass the "horizontal line test", and, if not bijections, their inverses will be only partial functions, not total functions of their domain.
Surjective ("onto") functions are those where every output is used, or alternatively, where the image and codomain are equivalent.
As the codomain is an arbitrary extension of the image, surjection can be easily forced by limiting the codomain to include only the image.
Bijective functions are those which are both injective and surjective; every element of the codomain is mapped-to exactly once.
These functions are the only ones that are invertible.
As examples,
`f:\mathbb N\to\mathbb R, f(x)=x` is an injection.
`f:\mathbb R\to\mathbb Z, f(x)=\lfloor x\rfloor` is a surjection.
`f:\mathbb R\to\mathbb R, f(x)=x` is a bijection.
`f:\mathbb R\to\mathbb R, f(x)=\pm\sqrt x` is not a function.