2 Sets and functions

2.8 Function properties

2.8.1 Image of a function

Definition 2.8.1.

Let f:XY. Then the image of f, written im(f), is defined to be {f(x):xX}.

Don’t confuse codomain and image. Y is the codomain of f and the image im(f) is a subset of Y, but it need not equal Y.

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 say image and codomain in MATH0005.

Example 2.8.1.
  • Let f: be the function f(x)=x2. Every element f(x) of the image of f is a nonnegative number, and every nonnegative number is the square of some real number, so im(f)=[0,).

  • Let g: be defined by g(z)=3z. Then im(g)={g(z):z}={3z:z}.

2.8.2 Injection, surjection, bijection

Definition 2.8.2.

Let f:XY be a function.

  • We say f is injective or one-to-one if and only if for all a,bX, if f(a)=f(b) then a=b.

  • We say f is surjective or onto if and only if for all yY there is at least one xX such that f(x)=y.

  • We say f 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 f:{1,2,3,4,5,6}{1,2,3,4,5}. I have drawn an arrow from x to f(x) for each x in the domain of f.

Figure 2.9: Drawing of a function from {1,2,3,4,5,6} to {1,2,3,4,5} such that f(1)=f(2)=1,f(3)=5,f(4)=3,f(5)=1,f(6)=2.

The function f shown in Figure 2.9 is not onto because im(f) is a proper subset of the codomain, specifically, the codomain contains 4 but im(f) does not. f is not one-to-one because f(1)=f(2) but 12.

Example 2.8.2.

Here are some more examples to illustrate the injective, surjective, and bijective properties.

  • f:,f(x)=x2. It isn’t injective as f(1)=f(1) and it isn’t surjective as 1 is in the codomain, but there’s no element x in the domain such that f(x)=1.

  • g:[0,),g(x)=x2. This is not injective for the same reason as before, but this time it is surjective: for each y0 we can find an element of the domain which g sends to y: for example. g(y)=y.

  • h:[0,),h(x)=x2. Not surjective, for the same reason f 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 h is injective: if x and y are in the domain of h and h(x)=h(y) then x2=y2, so x=±y. Since elements of the domain of h are nonnegative, it must be that x=y.

  • j:(,0][0,),j(x)=x2. This is injective (for a similar reason to h) and surjective (for a similar reason to g), 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 f(x)=x2 injective?” doesn’t make any sense unless you do this.

2.8.3 Bijections and sizes of sets

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 f between two sets X and Y. This gives us a way to pair up elements of X and elements of Y such that every element of X is paired with exactly one element of Y.

Consider the pairs (x,f(x)) for x in X. Every element of Y appears in exactly one of these pairs (at least one pair because f is onto, at most one pair because f is one-one). So a bijection pairs up each element of X with a unique element f(x) of Y.

Figure 2.10: Picture of a bijection f from {1,2,3} to {a,b,c} such that f(1)=c,f(2)=b,f(3)=a

The picture is an illustration of a bijection f:{1,2,3}{a,b,c}. If we pair each element x of the domain with its image f(x) we get the pairs (1,c),(2,b),(3,a). Because f 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 2={4,2,0,2,4,6,} have the same size since there is a bijection

f: 2
f(z) =2z

even though one is a proper subset of the other.