Remember that a function is a rule that maps one element of one set to only one element of another set?
In this topic, we will divide functions into three classes: injections, surjections, and bijections. This is important because functions of different classes are used in different situations: for example, any good cipher is an injective function. Why? Well, you'll have to read the topic and then come back to this question.
Injections
A function may send several elements of its domain to the same element of its codomain. In terms of arrow diagrams, this means that two or more arrows that start in the domain can point to the same element in the codomain. Some functions, though, associate a different element of its codomain to each element of its domain. They are called injective functions.
A function is called injective (or simply injection) if no two elements in the domain are mapped to the same element in the codomain, i.e.
For example:
What does it mean for a function not to be injective? It means there are two different elements such that .
Let's give some examples of injective and non-injective functions.
Suppose is a function from the set of integers to itself and for every integer
Is this function injective? Yes, because the equality is possible only when . You can also notice that such that is injective.
On the other hand, the function such thatwon't be injective. Indeed, both 2 and -2 are mapped to 4, and a similar situation holds for all pairs of numbers with the same absolute value and different signs.
Surjections
There may be an element of the co-domain of a function that is not the image of any element in the domain. On the other hand, a function may have the property that every element of its co-domain is the image of some element of its domain. Such a function is called onto or surjective.
Definition. A function is a surjective function (or surjection) if the codomain of is equal to the range of , i.e
For instance:
What does it mean for a function not to be surjective? It means there is an element such that for any , .
We know that both functions and from the previous section are functions from to :
These functions are not surjective: their codomain contains elements which are not a multiple of 3 (and so cannot be an output of ) and negative elements which cannot be a square of some integer (and so an output of ). On the other hand, defined by the formula is surjective: for any , there exists an integer such that . Namely,
Bijections
A function is bijective if it is both injective and surjective, i.e
For example:
We've already seen that defined by the formula is injective and surjective, so it is bijective.
Inverse function
If is bijective, there exists a function from to that "undoes" the action of – that is, it sends each element of back to the unique element of that it came from. This function is called the inverse function for and denoted by .
For example, if maps a real number to its cube:
its inverse will be a cube root function :
In the picture (arrow diagram) showing some function , we can reverse all the arrows and obtain a picture of .
Conclusion
In this topic, you've learned about injections, surjections and bijections. Here is a brief summary:
- a function is injective if it associates a different element of its codomain to each element of its domain;
- a function is surjective if every element of its co-domain is the image of some element of its domain;
- a function is bijective if it is both injective and surjective, and every bijective function has an inverse.
All that said, let's get back to the cipher from the intro. Of course, you need an injection function – two different messages should have different encoded versions; otherwise you will never be able to understand what the author meant.