We need to extend our set builder notation a little. If is a function, we write for the subset of consisting of all elements for . This set has a special name.
Let . Then the image of , written , is defined to be .
Don’t confuse codomain and image. is the codomain of and the image is a subset of , but it need not equal .
Some people use the word range to refer to one of these two concepts, but since different people use it for different things we will only use the terms image and codomain in MATH0005.
Let be the function . Every element of the image of is a nonnegative number, and every nonnegative number is the square of some real number, so .
Let be defined by . Then .
Let be a function.
We say is injective or one-to-one if and only if for all , if then .
We say is surjective or onto if and only if for all there is at least one such that .
We say is a bijection if and only if it is injective and surjective.
Another way to write the definition of surjective would be that a function is surjective if and only if its image equals its codomain.
As an example, here’s a picture of a function . There is an arrow from to for each in the domain of .
The function shown in Figure 2.9 is not onto because is a proper subset of the codomain, specifically, the codomain contains 4 but does not. is not one-to-one because but .
Here are some more examples to illustrate the injective, surjective, and bijective properties.
. It isn’t injective as and it isn’t surjective as is in the codomain, but there’s no element in the domain such that .
. This is not injective for the same reason as before, but this time it is surjective: for each we can find an element of the domain which sends to : for example. .
. Not surjective, for the same reason isn’t surjective (the codomain contains negative numbers, but the image doesn’t contain any negative numbers, so the image doesn’t equal the codomain). But is injective: if and are in the domain of and then , so . Since elements of the domain of are nonnegative, it must be that .
. This is injective (for a similar reason to ) and surjective (for a similar reason to ), so it is a bijection.
All of these functions had their rules described in the same way, but their properties differed. This shows how important it is to specify the domain and codomain when you talk about a function. A question like “is the function injective?” doesn’t make any sense unless you do this.
How do we know when two sets have the same size? If you see an alien creature with an apple in each of its hundreds of hands you know it has the same number of apples as it does hands, even if you haven’t counted either the apples or the hands.
You know that because you can pair each apple with the hand holding it. Every apple is held by one hand, and every hand holds one apple.
Suppose there is a bijection between two sets and . This gives us a way to pair up elements of and elements of such that every element of is paired with exactly one element of .
Consider the pairs for in . Every element of appears in exactly one of these pairs (at least one pair because is onto, at most one pair because is one-to-one). So a bijection pairs up each element of with a unique element of .
The picture shows a bijection . If we pair each element of the domain with its image we get the pairs . Because is a bijection, every element of the domain is paired with exactly one element of the domain and every element of the codomain is paired with exactly one element of the domain. This leads us to make the definition that two sets have the same size (or the same cardinality) if and only if there is a bijection between them.
This definition works even for infinite sets — though it sometimes provides some counter-intuitive results. The set of integers and the set of even integers have the same size since there is a bijection
even though one is a proper subset of the other.